mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 17:32:19 +00:00
Adding working version of assembly parser for the MBlaze backend
Major cleanup of whitespace and formatting issues in MBlaze backend git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118434 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
554375b707
commit
0a67d92938
@ -2,10 +2,10 @@ set(MSVC_LIB_DEPS_LLVMARMAsmParser LLVMARMInfo LLVMMC LLVMMCParser LLVMSupport L
|
||||
set(MSVC_LIB_DEPS_LLVMARMAsmPrinter LLVMMC LLVMSupport LLVMSystem)
|
||||
set(MSVC_LIB_DEPS_LLVMARMCodeGen LLVMARMAsmPrinter LLVMARMInfo LLVMAnalysis LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMARMDisassembler LLVMARMCodeGen LLVMARMInfo LLVMMC LLVMSupport LLVMSystem)
|
||||
set(MSVC_LIB_DEPS_LLVMARMInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMARMInfo LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMAlphaAsmPrinter LLVMAlphaInfo LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMAlphaCodeGen LLVMAlphaInfo LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMAlphaInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMAlphaInfo LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMAnalysis LLVMCore LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMArchive LLVMBitReader LLVMCore LLVMSupport LLVMSystem)
|
||||
set(MSVC_LIB_DEPS_LLVMAsmParser LLVMCore LLVMSupport LLVMSystem)
|
||||
@ -14,16 +14,16 @@ set(MSVC_LIB_DEPS_LLVMBitReader LLVMCore LLVMSupport LLVMSystem)
|
||||
set(MSVC_LIB_DEPS_LLVMBitWriter LLVMCore LLVMSupport LLVMSystem)
|
||||
set(MSVC_LIB_DEPS_LLVMBlackfinAsmPrinter LLVMAsmPrinter LLVMBlackfinInfo LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMBlackfinCodeGen LLVMBlackfinInfo LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMBlackfinInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMBlackfinInfo LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMCBackend LLVMAnalysis LLVMCBackendInfo LLVMCodeGen LLVMCore LLVMMC LLVMScalarOpts LLVMSupport LLVMSystem LLVMTarget LLVMTransformUtils LLVMipa)
|
||||
set(MSVC_LIB_DEPS_LLVMCBackendInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMCBackendInfo LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMCellSPUAsmPrinter LLVMAsmPrinter LLVMCellSPUInfo LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMCellSPUCodeGen LLVMCellSPUInfo LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMCellSPUInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMCellSPUInfo LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMCodeGen LLVMAnalysis LLVMCore LLVMMC LLVMScalarOpts LLVMSupport LLVMSystem LLVMTarget LLVMTransformUtils)
|
||||
set(MSVC_LIB_DEPS_LLVMCore LLVMSupport LLVMSystem)
|
||||
set(MSVC_LIB_DEPS_LLVMCppBackend LLVMCore LLVMCppBackendInfo LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMCppBackendInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMCppBackendInfo LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMExecutionEngine LLVMCore LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMInstCombine LLVMAnalysis LLVMCore LLVMSupport LLVMSystem LLVMTarget LLVMTransformUtils)
|
||||
set(MSVC_LIB_DEPS_LLVMInstrumentation LLVMAnalysis LLVMCore LLVMSupport LLVMSystem LLVMTransformUtils)
|
||||
@ -34,41 +34,41 @@ set(MSVC_LIB_DEPS_LLVMMBlazeAsmParser LLVMMBlazeInfo LLVMMC LLVMMCParser LLVMSup
|
||||
set(MSVC_LIB_DEPS_LLVMMBlazeAsmPrinter LLVMMC LLVMSupport LLVMSystem)
|
||||
set(MSVC_LIB_DEPS_LLVMMBlazeCodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMBlazeAsmPrinter LLVMMBlazeInfo LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMMBlazeDisassembler LLVMMBlazeCodeGen LLVMMBlazeInfo LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMMBlazeInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMMBlazeInfo LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMMC LLVMSupport LLVMSystem)
|
||||
set(MSVC_LIB_DEPS_LLVMMCDisassembler LLVMARMAsmParser LLVMARMCodeGen LLVMARMDisassembler LLVMARMInfo LLVMAlphaAsmPrinter LLVMAlphaCodeGen LLVMAlphaInfo LLVMBlackfinAsmPrinter LLVMBlackfinCodeGen LLVMBlackfinInfo LLVMCBackend LLVMCBackendInfo LLVMCellSPUAsmPrinter LLVMCellSPUCodeGen LLVMCellSPUInfo LLVMCppBackend LLVMCppBackendInfo LLVMMBlazeAsmParser LLVMMBlazeCodeGen LLVMMBlazeDisassembler LLVMMBlazeInfo LLVMMC LLVMMCParser LLVMMSP430CodeGen LLVMMSP430Info LLVMMipsAsmPrinter LLVMMipsCodeGen LLVMMipsInfo LLVMPTXAsmPrinter LLVMPTXCodeGen LLVMPTXInfo LLVMPowerPCAsmPrinter LLVMPowerPCCodeGen LLVMPowerPCInfo LLVMSparcAsmPrinter LLVMSparcCodeGen LLVMSparcInfo LLVMSupport LLVMSystem LLVMSystemZAsmPrinter LLVMSystemZCodeGen LLVMSystemZInfo LLVMX86AsmParser LLVMX86CodeGen LLVMX86Disassembler LLVMX86Info LLVMXCoreAsmPrinter LLVMXCoreCodeGen LLVMXCoreInfo)
|
||||
set(MSVC_LIB_DEPS_LLVMMCParser LLVMMC LLVMSupport LLVMSystem)
|
||||
set(MSVC_LIB_DEPS_LLVMMSP430AsmPrinter LLVMMC LLVMSupport LLVMSystem)
|
||||
set(MSVC_LIB_DEPS_LLVMMSP430CodeGen LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMMSP430AsmPrinter LLVMMSP430Info LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMMSP430Info LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMMSP430Info LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMMipsAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMMipsCodeGen LLVMMipsInfo LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMMipsCodeGen LLVMCodeGen LLVMCore LLVMMC LLVMMipsInfo LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMMipsInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMPTXAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMPTXInfo LLVMSupport LLVMSystem)
|
||||
set(MSVC_LIB_DEPS_LLVMMipsInfo LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMPTXAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMPTXCodeGen LLVMPTXInfo LLVMSupport LLVMSystem)
|
||||
set(MSVC_LIB_DEPS_LLVMPTXCodeGen LLVMCodeGen LLVMCore LLVMMC LLVMPTXInfo LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMPTXInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMPTXInfo LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMPowerPCAsmPrinter LLVMAnalysis LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMPowerPCInfo LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMPowerPCCodeGen LLVMCodeGen LLVMCore LLVMMC LLVMPowerPCInfo LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMPowerPCInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMPowerPCInfo LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMScalarOpts LLVMAnalysis LLVMCore LLVMInstCombine LLVMSupport LLVMSystem LLVMTarget LLVMTransformUtils)
|
||||
set(MSVC_LIB_DEPS_LLVMSelectionDAG LLVMAnalysis LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMSparcAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSparcInfo LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMSparcCodeGen LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSparcInfo LLVMSupport LLVMSystem LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMSparcInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMSparcInfo LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMSupport LLVMSystem)
|
||||
set(MSVC_LIB_DEPS_LLVMSystem )
|
||||
set(MSVC_LIB_DEPS_LLVMSystemZAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMSystem LLVMSystemZInfo LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMSystemZCodeGen LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystem LLVMSystemZInfo LLVMTarget)
|
||||
set(MSVC_LIB_DEPS_LLVMSystemZInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMSystemZInfo LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMTarget LLVMCore LLVMMC LLVMSupport LLVMSystem)
|
||||
set(MSVC_LIB_DEPS_LLVMTransformUtils LLVMAnalysis LLVMCore LLVMSupport LLVMSystem LLVMTarget LLVMipa)
|
||||
set(MSVC_LIB_DEPS_LLVMX86AsmParser LLVMMC LLVMMCParser LLVMSupport LLVMSystem LLVMTarget LLVMX86Info)
|
||||
set(MSVC_LIB_DEPS_LLVMX86AsmPrinter LLVMMC LLVMSupport LLVMSystem)
|
||||
set(MSVC_LIB_DEPS_LLVMX86CodeGen LLVMAnalysis LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget LLVMX86AsmPrinter LLVMX86Info)
|
||||
set(MSVC_LIB_DEPS_LLVMX86Disassembler LLVMMC LLVMSupport LLVMX86Info)
|
||||
set(MSVC_LIB_DEPS_LLVMX86Info LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMX86Info LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMXCoreAsmPrinter LLVMAsmPrinter LLVMCodeGen LLVMCore LLVMMC LLVMSupport LLVMSystem LLVMTarget LLVMXCoreInfo)
|
||||
set(MSVC_LIB_DEPS_LLVMXCoreCodeGen LLVMCodeGen LLVMCore LLVMMC LLVMSelectionDAG LLVMSupport LLVMSystem LLVMTarget LLVMXCoreInfo)
|
||||
set(MSVC_LIB_DEPS_LLVMXCoreInfo LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMXCoreInfo LLVMMC LLVMSupport)
|
||||
set(MSVC_LIB_DEPS_LLVMipa LLVMAnalysis LLVMCore LLVMSupport LLVMSystem)
|
||||
set(MSVC_LIB_DEPS_LLVMipo LLVMAnalysis LLVMCore LLVMScalarOpts LLVMSupport LLVMSystem LLVMTarget LLVMTransformUtils LLVMipa)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -473,10 +473,7 @@ bool MBlazeDisassembler::getInstruction(MCInst &instr,
|
||||
|
||||
uint64_t tsFlags = MBlazeInsts[opcode].TSFlags;
|
||||
switch ((tsFlags & MBlazeII::FormMask)) {
|
||||
default:
|
||||
errs() << "Opcode: " << MBlazeInsts[opcode].Name << "\n";
|
||||
errs() << "Flags: "; errs().write_hex( tsFlags ); errs() << "\n";
|
||||
return false;
|
||||
default: llvm_unreachable("unknown instruction encoding");
|
||||
|
||||
case MBlazeII::FRRR:
|
||||
instr.addOperand(MCOperand::CreateReg(getRD(insn)));
|
||||
|
@ -159,7 +159,6 @@ SelectAddrRegImm(SDValue N, SDValue &Disp, SDValue &Base) {
|
||||
} else {
|
||||
Base = N.getOperand(0);
|
||||
}
|
||||
DEBUG( errs() << "WESLEY: Using Operand Immediate\n" );
|
||||
return true; // [r+i]
|
||||
}
|
||||
} else if (ConstantSDNode *CN = dyn_cast<ConstantSDNode>(N)) {
|
||||
@ -167,7 +166,6 @@ SelectAddrRegImm(SDValue N, SDValue &Disp, SDValue &Base) {
|
||||
uint32_t Imm = CN->getZExtValue();
|
||||
Disp = CurDAG->getTargetConstant(Imm, CN->getValueType(0));
|
||||
Base = CurDAG->getRegister(MBlaze::R0, CN->getValueType(0));
|
||||
DEBUG( errs() << "WESLEY: Using Constant Node\n" );
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -192,14 +190,9 @@ SDNode* MBlazeDAGToDAGISel::Select(SDNode *Node) {
|
||||
unsigned Opcode = Node->getOpcode();
|
||||
DebugLoc dl = Node->getDebugLoc();
|
||||
|
||||
// Dump information about the Node being selected
|
||||
DEBUG(errs() << "Selecting: "; Node->dump(CurDAG); errs() << "\n");
|
||||
|
||||
// If we have a custom node, we already have selected!
|
||||
if (Node->isMachineOpcode()) {
|
||||
DEBUG(errs() << "== "; Node->dump(CurDAG); errs() << "\n");
|
||||
if (Node->isMachineOpcode())
|
||||
return NULL;
|
||||
}
|
||||
|
||||
///
|
||||
// Instruction Selection not handled by the auto-generated
|
||||
|
@ -64,6 +64,16 @@ def HasMMU : Predicate<"Subtarget.hasMMU()">;
|
||||
// MBlaze Operand, Complex Patterns and Transformations Definitions.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
def MBlazeMemAsmOperand : AsmOperandClass {
|
||||
let Name = "Mem";
|
||||
let SuperClasses = [];
|
||||
}
|
||||
|
||||
def MBlazeFslAsmOperand : AsmOperandClass {
|
||||
let Name = "Fsl";
|
||||
let SuperClasses = [];
|
||||
}
|
||||
|
||||
// Instruction operand types
|
||||
def brtarget : Operand<OtherVT>;
|
||||
def calltarget : Operand<i32>;
|
||||
@ -79,17 +89,20 @@ def uimm16 : Operand<i32> {
|
||||
// FSL Operand
|
||||
def fslimm : Operand<i32> {
|
||||
let PrintMethod = "printFSLImm";
|
||||
let ParserMatchClass = MBlazeFslAsmOperand;
|
||||
}
|
||||
|
||||
// Address operand
|
||||
def memri : Operand<i32> {
|
||||
let PrintMethod = "printMemOperand";
|
||||
let MIOperandInfo = (ops simm16, GPR);
|
||||
let ParserMatchClass = MBlazeMemAsmOperand;
|
||||
}
|
||||
|
||||
def memrr : Operand<i32> {
|
||||
let PrintMethod = "printMemOperand";
|
||||
let MIOperandInfo = (ops GPR, GPR);
|
||||
let ParserMatchClass = MBlazeMemAsmOperand;
|
||||
}
|
||||
|
||||
// Node immediate fits as 16-bit sign extended on target immediate.
|
||||
@ -497,7 +510,7 @@ let isReturn=1, isTerminator=1, hasDelaySlot=1, isBarrier=1,
|
||||
let isReturn=1, isTerminator=1, hasDelaySlot=1, isBarrier=1,
|
||||
hasCtrlDep=1, rd=0x11, Form=FCRI in {
|
||||
def RTID : TB<0x2D, (outs), (ins GPR:$target, simm16:$imm),
|
||||
"rtsd $target, $imm",
|
||||
"rtid $target, $imm",
|
||||
[],
|
||||
IIBranch>;
|
||||
}
|
||||
@ -505,7 +518,7 @@ let isReturn=1, isTerminator=1, hasDelaySlot=1, isBarrier=1,
|
||||
let isReturn=1, isTerminator=1, hasDelaySlot=1, isBarrier=1,
|
||||
hasCtrlDep=1, rd=0x12, Form=FCRI in {
|
||||
def RTBD : TB<0x2D, (outs), (ins GPR:$target, simm16:$imm),
|
||||
"rtsd $target, $imm",
|
||||
"rtbd $target, $imm",
|
||||
[],
|
||||
IIBranch>;
|
||||
}
|
||||
@ -513,7 +526,7 @@ let isReturn=1, isTerminator=1, hasDelaySlot=1, isBarrier=1,
|
||||
let isReturn=1, isTerminator=1, hasDelaySlot=1, isBarrier=1,
|
||||
hasCtrlDep=1, rd=0x14, Form=FCRI in {
|
||||
def RTED : TB<0x2D, (outs), (ins GPR:$target, simm16:$imm),
|
||||
"rtsd $target, $imm",
|
||||
"rted $target, $imm",
|
||||
[],
|
||||
IIBranch>;
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ namespace llvm {
|
||||
|
||||
void Initialize(MCContext &Ctx, const TargetMachine &TM);
|
||||
|
||||
|
||||
/// IsGlobalInSmallSection - Return true if this global address should be
|
||||
/// placed into small data/bss section.
|
||||
bool IsGlobalInSmallSection(const GlobalValue *GV,
|
||||
|
@ -1,8 +1,5 @@
|
||||
* Writing out ELF files is close to working but the following needs to
|
||||
be examined more closely:
|
||||
- ELF files are written with the wrong E_MACHINE value because
|
||||
ELFObjectWriter::WriteHeader function does not yet support
|
||||
target specific E_MACHINE values.
|
||||
- ELF relocation records are incorrect because the function
|
||||
ELFObjectWriter::RecordRelocation is hard coded for X86/X86-64.
|
||||
- Relocations use 2-byte / 4-byte to terminology in reference to
|
||||
@ -32,3 +29,11 @@
|
||||
and need to be updated to model the MicroBlaze correctly.
|
||||
- Look at the MBlazeGenFastISel.inc stuff and make use of it
|
||||
if appropriate.
|
||||
|
||||
* A basic assembly parser is present now and seems to parse most things.
|
||||
There are a few things that need to be looked at:
|
||||
- There are some instructions that are not generated by the backend
|
||||
and have not been tested as far as the parser is concerned.
|
||||
- The assembly parser does not use any MicroBlaze specific directives.
|
||||
I should investigate if there are MicroBlaze specific directive and,
|
||||
if there are, add them.
|
||||
|
Loading…
x
Reference in New Issue
Block a user