mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 04:30:12 +00:00
Don't require pseudo-instructions to carry encoding information.
For now this is distinct from isCodeGenOnly, as code-gen-only instructions can (and often do) still have encoding information associated with them. Once we've migrated all of them over to true pseudo-instructions that are lowered to real instructions prior to the printer/emitter, we can remove isCodeGenOnly and just use isPseudo. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134539 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
231a5ab746
commit
806fcc040e
@ -324,6 +324,9 @@ class Instruction {
|
|||||||
bit isAsCheapAsAMove = 0; // As cheap (or cheaper) than a move instruction.
|
bit isAsCheapAsAMove = 0; // As cheap (or cheaper) than a move instruction.
|
||||||
bit hasExtraSrcRegAllocReq = 0; // Sources have special regalloc requirement?
|
bit hasExtraSrcRegAllocReq = 0; // Sources have special regalloc requirement?
|
||||||
bit hasExtraDefRegAllocReq = 0; // Defs have special regalloc requirement?
|
bit hasExtraDefRegAllocReq = 0; // Defs have special regalloc requirement?
|
||||||
|
bit isPseudo = 0; // Is this instruction a pseudo-instruction?
|
||||||
|
// If so, won't have encoding information for
|
||||||
|
// the [MC]CodeEmitter stuff.
|
||||||
|
|
||||||
// Side effect flags - When set, the flags have these meanings:
|
// Side effect flags - When set, the flags have these meanings:
|
||||||
//
|
//
|
||||||
@ -338,6 +341,11 @@ class Instruction {
|
|||||||
// Is this instruction a "real" instruction (with a distinct machine
|
// Is this instruction a "real" instruction (with a distinct machine
|
||||||
// encoding), or is it a pseudo instruction used for codegen modeling
|
// encoding), or is it a pseudo instruction used for codegen modeling
|
||||||
// purposes.
|
// purposes.
|
||||||
|
// FIXME: For now this is distinct from isPseudo, above, as code-gen-only
|
||||||
|
// instructions can (and often do) still have encoding information
|
||||||
|
// associated with them. Once we've migrated all of them over to true
|
||||||
|
// pseudo-instructions that are lowered to real instructions prior to
|
||||||
|
// the printer/emitter, we can remove this attribute and just use isPseudo.
|
||||||
bit isCodeGenOnly = 0;
|
bit isCodeGenOnly = 0;
|
||||||
|
|
||||||
// Is this instruction a pseudo instruction for use by the assembler parser.
|
// Is this instruction a pseudo instruction for use by the assembler parser.
|
||||||
|
@ -421,6 +421,9 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
// Populates the insn given the uid.
|
// Populates the insn given the uid.
|
||||||
void insnWithID(insn_t &Insn, unsigned Opcode) const {
|
void insnWithID(insn_t &Insn, unsigned Opcode) const {
|
||||||
|
if (AllInstructions[Opcode]->isPseudo)
|
||||||
|
return;
|
||||||
|
|
||||||
BitsInit &Bits = getBitsField(*AllInstructions[Opcode]->TheDef, "Inst");
|
BitsInit &Bits = getBitsField(*AllInstructions[Opcode]->TheDef, "Inst");
|
||||||
|
|
||||||
for (unsigned i = 0; i < BIT_WIDTH; ++i)
|
for (unsigned i = 0; i < BIT_WIDTH; ++i)
|
||||||
|
@ -34,7 +34,8 @@ void CodeEmitterGen::reverseBits(std::vector<Record*> &Insts) {
|
|||||||
for (std::vector<Record*>::iterator I = Insts.begin(), E = Insts.end();
|
for (std::vector<Record*>::iterator I = Insts.begin(), E = Insts.end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
Record *R = *I;
|
Record *R = *I;
|
||||||
if (R->getValueAsString("Namespace") == "TargetOpcode")
|
if (R->getValueAsString("Namespace") == "TargetOpcode" ||
|
||||||
|
R->getValueAsBit("isPseudo"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
BitsInit *BI = R->getValueAsBitsInit("Inst");
|
BitsInit *BI = R->getValueAsBitsInit("Inst");
|
||||||
@ -231,7 +232,8 @@ void CodeEmitterGen::run(raw_ostream &o) {
|
|||||||
const CodeGenInstruction *CGI = *IN;
|
const CodeGenInstruction *CGI = *IN;
|
||||||
Record *R = CGI->TheDef;
|
Record *R = CGI->TheDef;
|
||||||
|
|
||||||
if (R->getValueAsString("Namespace") == "TargetOpcode") {
|
if (R->getValueAsString("Namespace") == "TargetOpcode" ||
|
||||||
|
R->getValueAsBit("isPseudo")) {
|
||||||
o << " 0U,\n";
|
o << " 0U,\n";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -255,7 +257,8 @@ void CodeEmitterGen::run(raw_ostream &o) {
|
|||||||
for (std::vector<Record*>::iterator IC = Insts.begin(), EC = Insts.end();
|
for (std::vector<Record*>::iterator IC = Insts.begin(), EC = Insts.end();
|
||||||
IC != EC; ++IC) {
|
IC != EC; ++IC) {
|
||||||
Record *R = *IC;
|
Record *R = *IC;
|
||||||
if (R->getValueAsString("Namespace") == "TargetOpcode")
|
if (R->getValueAsString("Namespace") == "TargetOpcode" ||
|
||||||
|
R->getValueAsBit("isPseudo"))
|
||||||
continue;
|
continue;
|
||||||
const std::string &InstName = R->getValueAsString("Namespace") + "::"
|
const std::string &InstName = R->getValueAsString("Namespace") + "::"
|
||||||
+ R->getName();
|
+ R->getName();
|
||||||
|
@ -311,6 +311,7 @@ CodeGenInstruction::CodeGenInstruction(Record *R) : TheDef(R), Operands(R) {
|
|||||||
isAsCheapAsAMove = R->getValueAsBit("isAsCheapAsAMove");
|
isAsCheapAsAMove = R->getValueAsBit("isAsCheapAsAMove");
|
||||||
hasExtraSrcRegAllocReq = R->getValueAsBit("hasExtraSrcRegAllocReq");
|
hasExtraSrcRegAllocReq = R->getValueAsBit("hasExtraSrcRegAllocReq");
|
||||||
hasExtraDefRegAllocReq = R->getValueAsBit("hasExtraDefRegAllocReq");
|
hasExtraDefRegAllocReq = R->getValueAsBit("hasExtraDefRegAllocReq");
|
||||||
|
isPseudo = R->getValueAsBit("isPseudo");
|
||||||
ImplicitDefs = R->getValueAsListOfDefs("Defs");
|
ImplicitDefs = R->getValueAsListOfDefs("Defs");
|
||||||
ImplicitUses = R->getValueAsListOfDefs("Uses");
|
ImplicitUses = R->getValueAsListOfDefs("Uses");
|
||||||
|
|
||||||
|
@ -235,6 +235,7 @@ namespace llvm {
|
|||||||
bool isAsCheapAsAMove;
|
bool isAsCheapAsAMove;
|
||||||
bool hasExtraSrcRegAllocReq;
|
bool hasExtraSrcRegAllocReq;
|
||||||
bool hasExtraDefRegAllocReq;
|
bool hasExtraDefRegAllocReq;
|
||||||
|
bool isPseudo;
|
||||||
|
|
||||||
|
|
||||||
CodeGenInstruction(Record *R);
|
CodeGenInstruction(Record *R);
|
||||||
|
@ -774,6 +774,11 @@ static void populateInstInfo(CompoundConstantEmitter &infoArray,
|
|||||||
for (index = 0; index < numInstructions; ++index) {
|
for (index = 0; index < numInstructions; ++index) {
|
||||||
const CodeGenInstruction& inst = *numberedInstructions[index];
|
const CodeGenInstruction& inst = *numberedInstructions[index];
|
||||||
|
|
||||||
|
// We don't need to do anything for pseudo-instructions, as we'll never
|
||||||
|
// see them here. We'll only see real instructions.
|
||||||
|
if (inst.isPseudo)
|
||||||
|
continue;
|
||||||
|
|
||||||
CompoundConstantEmitter *infoStruct = new CompoundConstantEmitter;
|
CompoundConstantEmitter *infoStruct = new CompoundConstantEmitter;
|
||||||
infoArray.addEntry(infoStruct);
|
infoArray.addEntry(infoStruct);
|
||||||
|
|
||||||
|
@ -1225,14 +1225,14 @@ bool FixedLenDecoderEmitter::populateInstruction(const CodeGenInstruction &CGI,
|
|||||||
//
|
//
|
||||||
// This also removes pseudo instructions from considerations of disassembly,
|
// This also removes pseudo instructions from considerations of disassembly,
|
||||||
// which is a better design and less fragile than the name matchings.
|
// which is a better design and less fragile than the name matchings.
|
||||||
BitsInit &Bits = getBitsField(Def, "Inst");
|
|
||||||
if (Bits.allInComplete()) return false;
|
|
||||||
|
|
||||||
// Ignore "asm parser only" instructions.
|
// Ignore "asm parser only" instructions.
|
||||||
if (Def.getValueAsBit("isAsmParserOnly") ||
|
if (Def.getValueAsBit("isAsmParserOnly") ||
|
||||||
Def.getValueAsBit("isCodeGenOnly"))
|
Def.getValueAsBit("isCodeGenOnly"))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
BitsInit &Bits = getBitsField(Def, "Inst");
|
||||||
|
if (Bits.allInComplete()) return false;
|
||||||
|
|
||||||
std::vector<OperandInfo> InsnOperands;
|
std::vector<OperandInfo> InsnOperands;
|
||||||
|
|
||||||
// If the instruction has specified a custom decoding hook, use that instead
|
// If the instruction has specified a custom decoding hook, use that instead
|
||||||
@ -1354,7 +1354,8 @@ bool FixedLenDecoderEmitter::populateInstruction(const CodeGenInstruction &CGI,
|
|||||||
void FixedLenDecoderEmitter::populateInstructions() {
|
void FixedLenDecoderEmitter::populateInstructions() {
|
||||||
for (unsigned i = 0, e = NumberedInstructions.size(); i < e; ++i) {
|
for (unsigned i = 0, e = NumberedInstructions.size(); i < e; ++i) {
|
||||||
Record *R = NumberedInstructions[i]->TheDef;
|
Record *R = NumberedInstructions[i]->TheDef;
|
||||||
if (R->getValueAsString("Namespace") == "TargetOpcode")
|
if (R->getValueAsString("Namespace") == "TargetOpcode" ||
|
||||||
|
R->getValueAsBit("isPseudo"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (populateInstruction(*NumberedInstructions[i], i))
|
if (populateInstruction(*NumberedInstructions[i], i))
|
||||||
|
Loading…
Reference in New Issue
Block a user