Skip to content

Commit

Permalink
[CSKY 2/n] Add basic tablegen infra for CSKY
Browse files Browse the repository at this point in the history
This introduce basic tablegen infra such as CSKY{InstrFormats,InstrInfo,RegisterInfo,}.td.
For now, only add instruction definitions for basic CSKY ISA operations, and the instruction format and register info are almost complete.

Our initial target is a working MC layer rather than codegen, so appropriate SelectionDAG patterns will come later.

Differential Revision: https://reviews.llvm.org/D89180
  • Loading branch information
zixuan-wu committed Dec 7, 2020
1 parent efdd463 commit 365c405
Show file tree
Hide file tree
Showing 5 changed files with 857 additions and 0 deletions.
7 changes: 7 additions & 0 deletions llvm/lib/Target/CSKY/CMakeLists.txt
@@ -1,5 +1,12 @@
add_llvm_component_group(CSKY)

set(LLVM_TARGET_DEFINITIONS CSKY.td)

tablegen(LLVM CSKYGenRegisterInfo.inc -gen-register-info)
tablegen(LLVM CSKYGenInstrInfo.inc -gen-instr-info)

add_public_tablegen_target(CSKYCommonTableGen)

add_llvm_target(CSKYCodeGen
CSKYTargetMachine.cpp

Expand Down
32 changes: 32 additions & 0 deletions llvm/lib/Target/CSKY/CSKY.td
@@ -0,0 +1,32 @@
//===-- CSKY.td - Describe the CSKY Target Machine ---------*- tablegen -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

include "llvm/Target/Target.td"

//===----------------------------------------------------------------------===//
// Registers, calling conventions, instruction descriptions.
//===----------------------------------------------------------------------===//

include "CSKYRegisterInfo.td"
include "CSKYInstrInfo.td"

//===----------------------------------------------------------------------===//
// CSKY processors supported.
//===----------------------------------------------------------------------===//

def : ProcessorModel<"generic-csky", NoSchedModel, []>;

//===----------------------------------------------------------------------===//
// Define the CSKY target.
//===----------------------------------------------------------------------===//

def CSKYInstrInfo : InstrInfo;

def CSKY : Target {
let InstructionSet = CSKYInstrInfo;
}

0 comments on commit 365c405

Please sign in to comment.