From 9bbf439e388c1d015558815fc47a56919de5ae3b Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 29 Oct 2002 17:43:19 +0000 Subject: [PATCH] Implement MachineInstrInfo interface git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4394 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86InstrInfo.cpp | 15 ++++----- lib/Target/X86/X86InstrInfo.h | 54 +++++++++++++++++++++++++++++++-- 2 files changed, 59 insertions(+), 10 deletions(-) diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp index f7185348ef9..06abb4dbf7b 100644 --- a/lib/Target/X86/X86InstrInfo.cpp +++ b/lib/Target/X86/X86InstrInfo.cpp @@ -5,25 +5,26 @@ //===----------------------------------------------------------------------===// #include "X86InstructionInfo.h" -#include "llvm/CodeGen/MInstruction.h" -#include +#include "llvm/CodeGen/MachineInstr.h" +#include // 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"; } diff --git a/lib/Target/X86/X86InstrInfo.h b/lib/Target/X86/X86InstrInfo.h index 95c292523e3..d9a9de1765d 100644 --- a/lib/Target/X86/X86InstrInfo.h +++ b/lib/Target/X86/X86InstrInfo.h @@ -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& mvec, + MachineCodeForInstruction& mcfi) const { abort(); } + void CreateCodeToCopyIntToFloat(const TargetMachine& target, + Function* F, Value* val, Instruction* dest, + std::vector& mvec, + MachineCodeForInstruction& mcfi) const { + abort(); + } + void CreateCodeToCopyFloatToInt(const TargetMachine& target, Function* F, + Value* val, Instruction* dest, + std::vector& mvec, + MachineCodeForInstruction& mcfi)const { + abort(); + } + void CreateCopyInstructionsByType(const TargetMachine& target, + Function* F, Value* src, + Instruction* dest, + std::vector& mvec, + MachineCodeForInstruction& mcfi)const { + abort(); + } + + void CreateSignExtensionInstructions(const TargetMachine& target, + Function* F, Value* srcVal, + Value* destVal, unsigned numLowBits, + std::vector& mvec, + MachineCodeForInstruction& mcfi) const { + abort(); + } + + void CreateZeroExtensionInstructions(const TargetMachine& target, + Function* F, Value* srcVal, + Value* destVal, unsigned srcSizeInBits, + std::vector& mvec, + MachineCodeForInstruction& mcfi) const { + abort(); + } }; -- 2.34.1