mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-08 13:00:50 +00:00
Add a base class for Mips TargetMachines and add Mips64 TargetMachines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140233 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8c1b4bf066
commit
2464810ac2
@ -18,7 +18,8 @@ using namespace llvm;
|
|||||||
|
|
||||||
MipsMCAsmInfo::MipsMCAsmInfo(const Target &T, StringRef TT) {
|
MipsMCAsmInfo::MipsMCAsmInfo(const Target &T, StringRef TT) {
|
||||||
Triple TheTriple(TT);
|
Triple TheTriple(TT);
|
||||||
if (TheTriple.getArch() == Triple::mips)
|
if ((TheTriple.getArch() == Triple::mips) ||
|
||||||
|
(TheTriple.getArch() == Triple::mips64))
|
||||||
IsLittleEndian = false;
|
IsLittleEndian = false;
|
||||||
|
|
||||||
AlignmentIsInBytes = false;
|
AlignmentIsInBytes = false;
|
||||||
|
@ -81,27 +81,49 @@ extern "C" void LLVMInitializeMipsTargetMC() {
|
|||||||
// Register the MC asm info.
|
// Register the MC asm info.
|
||||||
RegisterMCAsmInfoFn X(TheMipsTarget, createMipsMCAsmInfo);
|
RegisterMCAsmInfoFn X(TheMipsTarget, createMipsMCAsmInfo);
|
||||||
RegisterMCAsmInfoFn Y(TheMipselTarget, createMipsMCAsmInfo);
|
RegisterMCAsmInfoFn Y(TheMipselTarget, createMipsMCAsmInfo);
|
||||||
|
RegisterMCAsmInfoFn A(TheMips64Target, createMipsMCAsmInfo);
|
||||||
|
RegisterMCAsmInfoFn B(TheMips64elTarget, createMipsMCAsmInfo);
|
||||||
|
|
||||||
// Register the MC codegen info.
|
// Register the MC codegen info.
|
||||||
TargetRegistry::RegisterMCCodeGenInfo(TheMipsTarget,
|
TargetRegistry::RegisterMCCodeGenInfo(TheMipsTarget,
|
||||||
createMipsMCCodeGenInfo);
|
createMipsMCCodeGenInfo);
|
||||||
TargetRegistry::RegisterMCCodeGenInfo(TheMipselTarget,
|
TargetRegistry::RegisterMCCodeGenInfo(TheMipselTarget,
|
||||||
createMipsMCCodeGenInfo);
|
createMipsMCCodeGenInfo);
|
||||||
|
TargetRegistry::RegisterMCCodeGenInfo(TheMips64Target,
|
||||||
|
createMipsMCCodeGenInfo);
|
||||||
|
TargetRegistry::RegisterMCCodeGenInfo(TheMips64elTarget,
|
||||||
|
createMipsMCCodeGenInfo);
|
||||||
|
|
||||||
// Register the MC instruction info.
|
// Register the MC instruction info.
|
||||||
TargetRegistry::RegisterMCInstrInfo(TheMipsTarget, createMipsMCInstrInfo);
|
TargetRegistry::RegisterMCInstrInfo(TheMipsTarget, createMipsMCInstrInfo);
|
||||||
|
TargetRegistry::RegisterMCInstrInfo(TheMipselTarget, createMipsMCInstrInfo);
|
||||||
|
TargetRegistry::RegisterMCInstrInfo(TheMips64Target, createMipsMCInstrInfo);
|
||||||
|
TargetRegistry::RegisterMCInstrInfo(TheMips64elTarget, createMipsMCInstrInfo);
|
||||||
|
|
||||||
// Register the MC register info.
|
// Register the MC register info.
|
||||||
TargetRegistry::RegisterMCRegInfo(TheMipsTarget, createMipsMCRegisterInfo);
|
TargetRegistry::RegisterMCRegInfo(TheMipsTarget, createMipsMCRegisterInfo);
|
||||||
TargetRegistry::RegisterMCRegInfo(TheMipselTarget, createMipsMCRegisterInfo);
|
TargetRegistry::RegisterMCRegInfo(TheMipselTarget, createMipsMCRegisterInfo);
|
||||||
|
TargetRegistry::RegisterMCRegInfo(TheMips64Target, createMipsMCRegisterInfo);
|
||||||
|
TargetRegistry::RegisterMCRegInfo(TheMips64elTarget,
|
||||||
|
createMipsMCRegisterInfo);
|
||||||
|
|
||||||
// Register the MC subtarget info.
|
// Register the MC subtarget info.
|
||||||
TargetRegistry::RegisterMCSubtargetInfo(TheMipsTarget,
|
TargetRegistry::RegisterMCSubtargetInfo(TheMipsTarget,
|
||||||
createMipsMCSubtargetInfo);
|
createMipsMCSubtargetInfo);
|
||||||
|
TargetRegistry::RegisterMCSubtargetInfo(TheMipselTarget,
|
||||||
|
createMipsMCSubtargetInfo);
|
||||||
|
TargetRegistry::RegisterMCSubtargetInfo(TheMips64Target,
|
||||||
|
createMipsMCSubtargetInfo);
|
||||||
|
TargetRegistry::RegisterMCSubtargetInfo(TheMips64elTarget,
|
||||||
|
createMipsMCSubtargetInfo);
|
||||||
|
|
||||||
// Register the MCInstPrinter.
|
// Register the MCInstPrinter.
|
||||||
TargetRegistry::RegisterMCInstPrinter(TheMipsTarget,
|
TargetRegistry::RegisterMCInstPrinter(TheMipsTarget,
|
||||||
createMipsMCInstPrinter);
|
createMipsMCInstPrinter);
|
||||||
TargetRegistry::RegisterMCInstPrinter(TheMipselTarget,
|
TargetRegistry::RegisterMCInstPrinter(TheMipselTarget,
|
||||||
createMipsMCInstPrinter);
|
createMipsMCInstPrinter);
|
||||||
|
TargetRegistry::RegisterMCInstPrinter(TheMips64Target,
|
||||||
|
createMipsMCInstPrinter);
|
||||||
|
TargetRegistry::RegisterMCInstPrinter(TheMips64elTarget,
|
||||||
|
createMipsMCInstPrinter);
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,8 @@ class StringRef;
|
|||||||
|
|
||||||
extern Target TheMipsTarget;
|
extern Target TheMipsTarget;
|
||||||
extern Target TheMipselTarget;
|
extern Target TheMipselTarget;
|
||||||
|
extern Target TheMips64Target;
|
||||||
|
extern Target TheMips64elTarget;
|
||||||
|
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
|
||||||
|
@ -455,4 +455,6 @@ void MipsAsmPrinter::PrintDebugValueComment(const MachineInstr *MI,
|
|||||||
extern "C" void LLVMInitializeMipsAsmPrinter() {
|
extern "C" void LLVMInitializeMipsAsmPrinter() {
|
||||||
RegisterAsmPrinter<MipsAsmPrinter> X(TheMipsTarget);
|
RegisterAsmPrinter<MipsAsmPrinter> X(TheMipsTarget);
|
||||||
RegisterAsmPrinter<MipsAsmPrinter> Y(TheMipselTarget);
|
RegisterAsmPrinter<MipsAsmPrinter> Y(TheMipselTarget);
|
||||||
|
RegisterAsmPrinter<MipsAsmPrinter> A(TheMips64Target);
|
||||||
|
RegisterAsmPrinter<MipsAsmPrinter> B(TheMips64elTarget);
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,10 @@ using namespace llvm;
|
|||||||
|
|
||||||
extern "C" void LLVMInitializeMipsTarget() {
|
extern "C" void LLVMInitializeMipsTarget() {
|
||||||
// Register the target.
|
// Register the target.
|
||||||
RegisterTargetMachine<MipsTargetMachine> X(TheMipsTarget);
|
RegisterTargetMachine<MipsebTargetMachine> X(TheMipsTarget);
|
||||||
RegisterTargetMachine<MipselTargetMachine> Y(TheMipselTarget);
|
RegisterTargetMachine<MipselTargetMachine> Y(TheMipselTarget);
|
||||||
|
RegisterTargetMachine<Mips64ebTargetMachine> A(TheMips64Target);
|
||||||
|
RegisterTargetMachine<Mips64elTargetMachine> B(TheMips64elTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
// DataLayout --> Big-endian, 32-bit pointer/ABI/alignment
|
// DataLayout --> Big-endian, 32-bit pointer/ABI/alignment
|
||||||
@ -34,23 +36,45 @@ MipsTargetMachine::
|
|||||||
MipsTargetMachine(const Target &T, StringRef TT,
|
MipsTargetMachine(const Target &T, StringRef TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
Reloc::Model RM, CodeModel::Model CM,
|
Reloc::Model RM, CodeModel::Model CM,
|
||||||
bool isLittle=false):
|
bool isLittle):
|
||||||
LLVMTargetMachine(T, TT, CPU, FS, RM, CM),
|
LLVMTargetMachine(T, TT, CPU, FS, RM, CM),
|
||||||
Subtarget(TT, CPU, FS, isLittle),
|
Subtarget(TT, CPU, FS, isLittle),
|
||||||
DataLayout(isLittle ?
|
DataLayout(isLittle ?
|
||||||
std::string("e-p:32:32:32-i8:8:32-i16:16:32-i64:64:64-n32") :
|
(Subtarget.isABI_N64() ?
|
||||||
std::string("E-p:32:32:32-i8:8:32-i16:16:32-i64:64:64-n32")),
|
"e-p:64:64:64-i8:8:32-i16:16:32-i64:64:64-n32" :
|
||||||
|
"e-p:32:32:32-i8:8:32-i16:16:32-i64:64:64-n32") :
|
||||||
|
(Subtarget.isABI_N64() ?
|
||||||
|
"E-p:64:64:64-i8:8:32-i16:16:32-i64:64:64-n32" :
|
||||||
|
"E-p:32:32:32-i8:8:32-i16:16:32-i64:64:64-n32")),
|
||||||
InstrInfo(*this),
|
InstrInfo(*this),
|
||||||
FrameLowering(Subtarget),
|
FrameLowering(Subtarget),
|
||||||
TLInfo(*this), TSInfo(*this), JITInfo() {
|
TLInfo(*this), TSInfo(*this), JITInfo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MipsebTargetMachine::
|
||||||
|
MipsebTargetMachine(const Target &T, StringRef TT,
|
||||||
|
StringRef CPU, StringRef FS,
|
||||||
|
Reloc::Model RM, CodeModel::Model CM) :
|
||||||
|
MipsTargetMachine(T, TT, CPU, FS, RM, CM, false) {}
|
||||||
|
|
||||||
MipselTargetMachine::
|
MipselTargetMachine::
|
||||||
MipselTargetMachine(const Target &T, StringRef TT,
|
MipselTargetMachine(const Target &T, StringRef TT,
|
||||||
StringRef CPU, StringRef FS,
|
StringRef CPU, StringRef FS,
|
||||||
Reloc::Model RM, CodeModel::Model CM) :
|
Reloc::Model RM, CodeModel::Model CM) :
|
||||||
MipsTargetMachine(T, TT, CPU, FS, RM, CM, true) {}
|
MipsTargetMachine(T, TT, CPU, FS, RM, CM, true) {}
|
||||||
|
|
||||||
|
Mips64ebTargetMachine::
|
||||||
|
Mips64ebTargetMachine(const Target &T, StringRef TT,
|
||||||
|
StringRef CPU, StringRef FS,
|
||||||
|
Reloc::Model RM, CodeModel::Model CM) :
|
||||||
|
MipsTargetMachine(T, TT, CPU, FS, RM, CM, false) {}
|
||||||
|
|
||||||
|
Mips64elTargetMachine::
|
||||||
|
Mips64elTargetMachine(const Target &T, StringRef TT,
|
||||||
|
StringRef CPU, StringRef FS,
|
||||||
|
Reloc::Model RM, CodeModel::Model CM) :
|
||||||
|
MipsTargetMachine(T, TT, CPU, FS, RM, CM, true) {}
|
||||||
|
|
||||||
// Install an instruction selector pass using
|
// Install an instruction selector pass using
|
||||||
// the ISelDag to gen Mips code.
|
// the ISelDag to gen Mips code.
|
||||||
bool MipsTargetMachine::
|
bool MipsTargetMachine::
|
||||||
|
@ -80,7 +80,16 @@ namespace llvm {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// MipselTargetMachine - Mipsel target machine.
|
/// MipsebTargetMachine - Mips32 big endian target machine.
|
||||||
|
///
|
||||||
|
class MipsebTargetMachine : public MipsTargetMachine {
|
||||||
|
public:
|
||||||
|
MipsebTargetMachine(const Target &T, StringRef TT,
|
||||||
|
StringRef CPU, StringRef FS,
|
||||||
|
Reloc::Model RM, CodeModel::Model CM);
|
||||||
|
};
|
||||||
|
|
||||||
|
/// MipselTargetMachine - Mips32 little endian target machine.
|
||||||
///
|
///
|
||||||
class MipselTargetMachine : public MipsTargetMachine {
|
class MipselTargetMachine : public MipsTargetMachine {
|
||||||
public:
|
public:
|
||||||
@ -89,6 +98,23 @@ public:
|
|||||||
Reloc::Model RM, CodeModel::Model CM);
|
Reloc::Model RM, CodeModel::Model CM);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// MipsebTargetMachine - Mips32 big endian target machine.
|
||||||
|
///
|
||||||
|
class Mips64ebTargetMachine : public MipsTargetMachine {
|
||||||
|
public:
|
||||||
|
Mips64ebTargetMachine(const Target &T, StringRef TT,
|
||||||
|
StringRef CPU, StringRef FS,
|
||||||
|
Reloc::Model RM, CodeModel::Model CM);
|
||||||
|
};
|
||||||
|
|
||||||
|
/// MipselTargetMachine - Mips32 little endian target machine.
|
||||||
|
///
|
||||||
|
class Mips64elTargetMachine : public MipsTargetMachine {
|
||||||
|
public:
|
||||||
|
Mips64elTargetMachine(const Target &T, StringRef TT,
|
||||||
|
StringRef CPU, StringRef FS,
|
||||||
|
Reloc::Model RM, CodeModel::Model CM);
|
||||||
|
};
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
Target llvm::TheMipsTarget, llvm::TheMipselTarget;
|
Target llvm::TheMipsTarget, llvm::TheMipselTarget;
|
||||||
|
Target llvm::TheMips64Target, llvm::TheMips64elTarget;
|
||||||
|
|
||||||
extern "C" void LLVMInitializeMipsTargetInfo() {
|
extern "C" void LLVMInitializeMipsTargetInfo() {
|
||||||
RegisterTarget<Triple::mips,
|
RegisterTarget<Triple::mips,
|
||||||
@ -20,4 +21,11 @@ extern "C" void LLVMInitializeMipsTargetInfo() {
|
|||||||
|
|
||||||
RegisterTarget<Triple::mipsel,
|
RegisterTarget<Triple::mipsel,
|
||||||
/*HasJIT=*/true> Y(TheMipselTarget, "mipsel", "Mipsel");
|
/*HasJIT=*/true> Y(TheMipselTarget, "mipsel", "Mipsel");
|
||||||
|
|
||||||
|
RegisterTarget<Triple::mips64,
|
||||||
|
/*HasJIT=*/false> A(TheMips64Target, "mips64", "Mips64 [experimental]");
|
||||||
|
|
||||||
|
RegisterTarget<Triple::mips64el,
|
||||||
|
/*HasJIT=*/false> B(TheMips64elTarget,
|
||||||
|
"mips64el", "Mips64el [experimental]");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user