aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/PIC16/PIC16InstrFormats.td
diff options
context:
space:
mode:
authorSanjiv Gupta <sanjiv.gupta@microchip.com>2008-11-19 11:00:54 +0000
committerSanjiv Gupta <sanjiv.gupta@microchip.com>2008-11-19 11:00:54 +0000
commit085ae4ff5f4b703a03668ffd130e204791e9a876 (patch)
tree50927bf30fff92fd28b11b51e72002f26cad7a61 /lib/Target/PIC16/PIC16InstrFormats.td
parent5f334804a5042a5467cd52202f0294ed66c96095 (diff)
downloadexternal_llvm-085ae4ff5f4b703a03668ffd130e204791e9a876.zip
external_llvm-085ae4ff5f4b703a03668ffd130e204791e9a876.tar.gz
external_llvm-085ae4ff5f4b703a03668ffd130e204791e9a876.tar.bz2
Added a more function PIC16 backend. However to get this working a patch in
ExpandIntegerOperand (LegalizeIntegerTypes.cpp) is needed which is yet to be reworked and submitted. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59617 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/PIC16/PIC16InstrFormats.td')
-rw-r--r--lib/Target/PIC16/PIC16InstrFormats.td61
1 files changed, 33 insertions, 28 deletions
diff --git a/lib/Target/PIC16/PIC16InstrFormats.td b/lib/Target/PIC16/PIC16InstrFormats.td
index e8ecf6a..e213ea8 100644
--- a/lib/Target/PIC16/PIC16InstrFormats.td
+++ b/lib/Target/PIC16/PIC16InstrFormats.td
@@ -1,4 +1,4 @@
-//===- PIC16RegisterInfo.td - PIC16 Register defs ------------*- tblgen -*-===//
+//===- PIC16InstrFormats.td - PIC16 Instruction Formats-------*- tblgen -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -21,16 +21,17 @@
//===----------------------------------------------------------------------===//
// Generic PIC16 Format
+// PIC16 Instructions are 14-bit wide.
+
+// FIXME: Add Cooper Specific Formats if any.
+
class PIC16Inst<dag outs, dag ins, string asmstr, list<dag> pattern>
- : Instruction
-{
+ : Instruction {
field bits<14> Inst;
let Namespace = "PIC16";
-
dag OutOperandList = outs;
dag InOperandList = ins;
-
let AsmString = asmstr;
let Pattern = pattern;
}
@@ -38,16 +39,18 @@ class PIC16Inst<dag outs, dag ins, string asmstr, list<dag> pattern>
//===----------------------------------------------------------------------===//
// Byte Oriented instruction class in PIC16 : <|opcode|d|f|>
+// opcode = 6 bits.
+// d = direction = 1 bit.
+// f = file register address = 7 bits.
//===----------------------------------------------------------------------===//
-class ByteFormat<bits<6> op, dag outs, dag ins, string asmstr,
- list<dag> pattern>
- :PIC16Inst<outs, ins, asmstr, pattern>
-{
+class ByteFormat<bits<6> opcode, dag outs, dag ins, string asmstr,
+ list<dag> pattern>
+ :PIC16Inst<outs, ins, asmstr, pattern> {
bits<1> d;
bits<7> f;
- let Inst{13-8} = op;
+ let Inst{13-8} = opcode;
let Inst{7} = d;
let Inst{6-0} = f;
@@ -55,15 +58,18 @@ class ByteFormat<bits<6> op, dag outs, dag ins, string asmstr,
//===----------------------------------------------------------------------===//
// Bit Oriented instruction class in PIC16 : <|opcode|b|f|>
+// opcode = 4 bits.
+// b = bit specifier = 3 bits.
+// f = file register address = 7 bits.
//===----------------------------------------------------------------------===//
-class BitFormat<bits<4> op, dag outs, dag ins, string asmstr, list<dag> pattern>
- : PIC16Inst<outs, ins, asmstr, pattern>
-{
+class BitFormat<bits<4> opcode, dag outs, dag ins, string asmstr,
+ list<dag> pattern>
+ : PIC16Inst<outs, ins, asmstr, pattern> {
bits<3> b;
bits<7> f;
- let Inst{13-10} = op;
+ let Inst{13-10} = opcode;
let Inst{9-7} = b;
let Inst{6-0} = f;
@@ -71,32 +77,32 @@ class BitFormat<bits<4> op, dag outs, dag ins, string asmstr, list<dag> pattern>
//===----------------------------------------------------------------------===//
// Literal Format instruction class in PIC16 : <|opcode|k|>
+// opcode = 6 bits
+// k = literal = 8 bits
//===----------------------------------------------------------------------===//
-class LiteralFormat<bits<6> op, dag outs, dag ins, string asmstr,
+class LiteralFormat<bits<6> opcode, dag outs, dag ins, string asmstr,
list<dag> pattern>
- : PIC16Inst<outs, ins, asmstr, pattern>
-{
+ : PIC16Inst<outs, ins, asmstr, pattern> {
bits<8> k;
-
- let Inst{13-8} = op;
+ let Inst{13-8} = opcode;
let Inst{7-0} = k;
}
//===----------------------------------------------------------------------===//
// Control Format instruction class in PIC16 : <|opcode|k|>
+// opcode = 3 bits.
+// k = jump address = 11 bits.
//===----------------------------------------------------------------------===//
-class ControlFormat<bits<3> op, dag outs, dag ins, string asmstr,
+class ControlFormat<bits<3> opcode, dag outs, dag ins, string asmstr,
list<dag> pattern>
- :PIC16Inst<outs, ins, asmstr, pattern>
-{
+ : PIC16Inst<outs, ins, asmstr, pattern> {
bits<11> k;
-
- let Inst{13-11} = op;
+ let Inst{13-11} = opcode;
let Inst{10-0} = k;
}
@@ -105,8 +111,7 @@ class ControlFormat<bits<3> op, dag outs, dag ins, string asmstr,
// Pseudo instruction class in PIC16
//===----------------------------------------------------------------------===//
-class Pseudo<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>:
- PIC16Inst<outs, ins, asmstr, pattern>
-{
- let Inst{13-6} = op;
+class Pseudo<dag outs, dag ins, string asmstr, list<dag> pattern>
+ : PIC16Inst<outs, ins, asmstr, pattern> {
+ let Inst{13-6} = 0;
}