Implement MachineInstrInfo interface

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4394 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2002-10-29 17:43:19 +00:00
parent 79c033765c
commit 9bbf439e38
2 changed files with 59 additions and 10 deletions

View File

@ -5,25 +5,26 @@
//===----------------------------------------------------------------------===//
#include "X86InstructionInfo.h"
#include "llvm/CodeGen/MInstruction.h"
#include <ostream>
#include "llvm/CodeGen/MachineInstr.h"
#include <iostream>
// X86Insts - Turn the InstructionInfo.def file into a bunch of instruction
// descriptors
//
static const MInstructionDesc X86Insts[] = {
#define I(ENUM, NAME, FLAGS, TSFLAGS) { NAME, FLAGS, TSFLAGS },
static const MachineInstrDescriptor X86Insts[] = {
#define I(ENUM, NAME, FLAGS, TSFLAGS) \
{ NAME, -1, -1, 0, false, 0, 0, TSFLAGS, FLAGS },
#include "X86InstructionInfo.def"
};
X86InstructionInfo::X86InstructionInfo()
: MInstructionInfo(X86Insts, sizeof(X86Insts)/sizeof(X86Insts[0])) {
: MachineInstrInfo(X86Insts, sizeof(X86Insts)/sizeof(X86Insts[0]), 0) {
}
// print - Print out an x86 instruction in GAS syntax
void X86InstructionInfo::print(const MInstruction *MI, std::ostream &O) const {
void X86InstructionInfo::print(const MachineInstr *MI, std::ostream &O) const {
// FIXME: This sucks.
O << get(MI->getOpcode()).Name << "\n";
O << getName(MI->getOpCode()) << "\n";
}

View File

@ -7,10 +7,10 @@
#ifndef X86INSTRUCTIONINFO_H
#define X86INSTRUCTIONINFO_H
#include "llvm/Target/InstructionInfo.h"
#include "llvm/Target/MachineInstrInfo.h"
#include "X86RegisterInfo.h"
class X86InstructionInfo : public MInstructionInfo {
class X86InstructionInfo : public MachineInstrInfo {
const X86RegisterInfo RI;
public:
X86InstructionInfo();
@ -23,7 +23,55 @@ public:
/// print - Print out an x86 instruction in GAS syntax
///
virtual void print(const MInstruction *MI, std::ostream &O) const;
virtual void print(const MachineInstr *MI, std::ostream &O) const;
//===--------------------------------------------------------------------===//
//
// These are stubs for pure virtual methods that should be factored out of
// MachineInstrInfo. We never call them, we don't want them, but we need
// stubs so that we can instatiate our class.
//
MachineOpCode getNOPOpCode() const { abort(); }
void CreateCodeToLoadConst(const TargetMachine& target, Function* F,
Value *V, Instruction *I,
std::vector<MachineInstr*>& mvec,
MachineCodeForInstruction& mcfi) const { abort(); }
void CreateCodeToCopyIntToFloat(const TargetMachine& target,
Function* F, Value* val, Instruction* dest,
std::vector<MachineInstr*>& mvec,
MachineCodeForInstruction& mcfi) const {
abort();
}
void CreateCodeToCopyFloatToInt(const TargetMachine& target, Function* F,
Value* val, Instruction* dest,
std::vector<MachineInstr*>& mvec,
MachineCodeForInstruction& mcfi)const {
abort();
}
void CreateCopyInstructionsByType(const TargetMachine& target,
Function* F, Value* src,
Instruction* dest,
std::vector<MachineInstr*>& mvec,
MachineCodeForInstruction& mcfi)const {
abort();
}
void CreateSignExtensionInstructions(const TargetMachine& target,
Function* F, Value* srcVal,
Value* destVal, unsigned numLowBits,
std::vector<MachineInstr*>& mvec,
MachineCodeForInstruction& mcfi) const {
abort();
}
void CreateZeroExtensionInstructions(const TargetMachine& target,
Function* F, Value* srcVal,
Value* destVal, unsigned srcSizeInBits,
std::vector<MachineInstr*>& mvec,
MachineCodeForInstruction& mcfi) const {
abort();
}
};