Commit 659f1474 authored by Edward Z. Yang's avatar Edward Z. Yang
Browse files

Remove dead Alpha native backend.


Signed-off-by: Edward Z. Yang's avatarEdward Z. Yang <ezyang@mit.edu>
parent 470bedbb
......@@ -503,10 +503,6 @@ Library
RegClass
PIC
Platform
Alpha.Regs
Alpha.RegInfo
Alpha.Instr
Alpha.CodeGen
X86.Regs
X86.RegInfo
X86.Instr
......
This diff is collapsed.
-----------------------------------------------------------------------------
--
-- Machine-dependent assembly language
--
-- (c) The University of Glasgow 1993-2004
--
-----------------------------------------------------------------------------
#include "HsVersions.h"
#include "nativeGen/NCG.h"
module Alpha.Instr (
-- Cond(..),
-- Instr(..),
-- RI(..)
)
where
{-
import BlockId
import Regs
import Cmm
import FastString
import CLabel
data Cond
= ALWAYS -- For BI (same as BR)
| EQQ -- For CMP and BI (NB: "EQ" is a 1.3 Prelude name)
| GE -- For BI only
| GTT -- For BI only (NB: "GT" is a 1.3 Prelude name)
| LE -- For CMP and BI
| LTT -- For CMP and BI (NB: "LT" is a 1.3 Prelude name)
| NE -- For BI only
| NEVER -- For BI (null instruction)
| ULE -- For CMP only
| ULT -- For CMP only
deriving Eq
-- -----------------------------------------------------------------------------
-- Machine's assembly language
-- We have a few common "instructions" (nearly all the pseudo-ops) but
-- mostly all of 'Instr' is machine-specific.
-- Register or immediate
data RI
= RIReg Reg
| RIImm Imm
data Instr
-- comment pseudo-op
= COMMENT FastString
-- some static data spat out during code
-- generation. Will be extracted before
-- pretty-printing.
| LDATA Section [CmmStatic]
-- start a new basic block. Useful during
-- codegen, removed later. Preceding
-- instruction should be a jump, as per the
-- invariants for a BasicBlock (see Cmm).
| NEWBLOCK BlockId
-- specify current stack offset for
-- benefit of subsequent passes
| DELTA Int
-- | spill this reg to a stack slot
| SPILL Reg Int
-- | reload this reg from a stack slot
| RELOAD Int Reg
-- Loads and stores.
| LD Size Reg AddrMode -- size, dst, src
| LDA Reg AddrMode -- dst, src
| LDAH Reg AddrMode -- dst, src
| LDGP Reg AddrMode -- dst, src
| LDI Size Reg Imm -- size, dst, src
| ST Size Reg AddrMode -- size, src, dst
-- Int Arithmetic.
| CLR Reg -- dst
| ABS Size RI Reg -- size, src, dst
| NEG Size Bool RI Reg -- size, overflow, src, dst
| ADD Size Bool Reg RI Reg -- size, overflow, src, src, dst
| SADD Size Size Reg RI Reg -- size, scale, src, src, dst
| SUB Size Bool Reg RI Reg -- size, overflow, src, src, dst
| SSUB Size Size Reg RI Reg -- size, scale, src, src, dst
| MUL Size Bool Reg RI Reg -- size, overflow, src, src, dst
| DIV Size Bool Reg RI Reg -- size, unsigned, src, src, dst
| REM Size Bool Reg RI Reg -- size, unsigned, src, src, dst
-- Simple bit-twiddling.
| NOT RI Reg
| AND Reg RI Reg
| ANDNOT Reg RI Reg
| OR Reg RI Reg
| ORNOT Reg RI Reg
| XOR Reg RI Reg
| XORNOT Reg RI Reg
| SLL Reg RI Reg
| SRL Reg RI Reg
| SRA Reg RI Reg
| ZAP Reg RI Reg
| ZAPNOT Reg RI Reg
| NOP
-- Comparison
| CMP Cond Reg RI Reg
-- Float Arithmetic.
| FCLR Reg
| FABS Reg Reg
| FNEG Size Reg Reg
| FADD Size Reg Reg Reg
| FDIV Size Reg Reg Reg
| FMUL Size Reg Reg Reg
| FSUB Size Reg Reg Reg
| CVTxy Size Size Reg Reg
| FCMP Size Cond Reg Reg Reg
| FMOV Reg Reg
-- Jumping around.
| BI Cond Reg Imm
| BF Cond Reg Imm
| BR Imm
| JMP Reg AddrMode Int
| BSR Imm Int
| JSR Reg AddrMode Int
-- Alpha-specific pseudo-ops.
| FUNBEGIN CLabel
| FUNEND CLabel
-}
module Alpha.Ppr (
{-
pprReg,
pprSize,
pprCond,
pprAddr,
pprSectionHeader,
pprTypeAndSizeDecl,
pprRI,
pprRegRIReg,
pprSizeRegRegReg
-}
)
where
{-
#include "nativeGen/NCG.h"
#include "HsVersions.h"
import BlockId
import Cmm
import Regs -- may differ per-platform
import Instrs
import CLabel ( CLabel, pprCLabel, externallyVisibleCLabel,
labelDynamic, mkAsmTempLabel, entryLblToInfoLbl )
#if HAVE_SUBSECTIONS_VIA_SYMBOLS
import CLabel ( mkDeadStripPreventer )
#endif
import Panic ( panic )
import Unique ( pprUnique )
import Pretty
import FastString
import qualified Outputable
import Outputable ( Outputable, pprPanic, ppr, docToSDoc)
import Data.Array.ST
import Data.Word ( Word8 )
import Control.Monad.ST
import Data.Char ( chr, ord )
import Data.Maybe ( isJust )
pprReg :: Reg -> Doc
pprReg r
= case r of
RealReg i -> ppr_reg_no i
VirtualRegI u -> text "%vI_" <> asmSDoc (pprUnique u)
VirtualRegHi u -> text "%vHi_" <> asmSDoc (pprUnique u)
VirtualRegF u -> text "%vF_" <> asmSDoc (pprUnique u)
VirtualRegD u -> text "%vD_" <> asmSDoc (pprUnique u)
where
ppr_reg_no :: Int -> Doc
ppr_reg_no i = ptext
(case i of {
0 -> sLit "$0"; 1 -> sLit "$1";
2 -> sLit "$2"; 3 -> sLit "$3";
4 -> sLit "$4"; 5 -> sLit "$5";
6 -> sLit "$6"; 7 -> sLit "$7";
8 -> sLit "$8"; 9 -> sLit "$9";
10 -> sLit "$10"; 11 -> sLit "$11";
12 -> sLit "$12"; 13 -> sLit "$13";
14 -> sLit "$14"; 15 -> sLit "$15";
16 -> sLit "$16"; 17 -> sLit "$17";
18 -> sLit "$18"; 19 -> sLit "$19";
20 -> sLit "$20"; 21 -> sLit "$21";
22 -> sLit "$22"; 23 -> sLit "$23";
24 -> sLit "$24"; 25 -> sLit "$25";
26 -> sLit "$26"; 27 -> sLit "$27";
28 -> sLit "$28"; 29 -> sLit "$29";
30 -> sLit "$30"; 31 -> sLit "$31";
32 -> sLit "$f0"; 33 -> sLit "$f1";
34 -> sLit "$f2"; 35 -> sLit "$f3";
36 -> sLit "$f4"; 37 -> sLit "$f5";
38 -> sLit "$f6"; 39 -> sLit "$f7";
40 -> sLit "$f8"; 41 -> sLit "$f9";
42 -> sLit "$f10"; 43 -> sLit "$f11";
44 -> sLit "$f12"; 45 -> sLit "$f13";
46 -> sLit "$f14"; 47 -> sLit "$f15";
48 -> sLit "$f16"; 49 -> sLit "$f17";
50 -> sLit "$f18"; 51 -> sLit "$f19";
52 -> sLit "$f20"; 53 -> sLit "$f21";
54 -> sLit "$f22"; 55 -> sLit "$f23";
56 -> sLit "$f24"; 57 -> sLit "$f25";
58 -> sLit "$f26"; 59 -> sLit "$f27";
60 -> sLit "$f28"; 61 -> sLit "$f29";
62 -> sLit "$f30"; 63 -> sLit "$f31";
_ -> sLit "very naughty alpha register"
})
pprSize :: Size -> Doc
pprSize x = ptext (case x of
B -> sLit "b"
Bu -> sLit "bu"
-- W -> sLit "w" UNUSED
-- Wu -> sLit "wu" UNUSED
L -> sLit "l"
Q -> sLit "q"
-- FF -> sLit "f" UNUSED
-- DF -> sLit "d" UNUSED
-- GF -> sLit "g" UNUSED
-- SF -> sLit "s" UNUSED
TF -> sLit "t"
pprCond :: Cond -> Doc
pprCond c
= ptext (case c of
EQQ -> sLit "eq"
LTT -> sLit "lt"
LE -> sLit "le"
ULT -> sLit "ult"
ULE -> sLit "ule"
NE -> sLit "ne"
GTT -> sLit "gt"
GE -> sLit "ge")
pprAddr :: AddrMode -> Doc
pprAddr (AddrReg r) = parens (pprReg r)
pprAddr (AddrImm i) = pprImm i
pprAddr (AddrRegImm r1 i)
= (<>) (pprImm i) (parens (pprReg r1))
pprSectionHeader Text
= ptext (sLit "\t.text\n\t.align 3")
pprSectionHeader Data
= ptext (sLit "\t.data\n\t.align 3")
pprSectionHeader ReadOnlyData
= ptext (sLit "\t.data\n\t.align 3")
pprSectionHeader RelocatableReadOnlyData
= ptext (sLit "\t.data\n\t.align 3")
pprSectionHeader UninitialisedData
= ptext (sLit "\t.bss\n\t.align 3")
pprSectionHeader ReadOnlyData16
= ptext (sLit "\t.data\n\t.align 4")
pprSectionHeader (OtherSection sec)
= panic "PprMach.pprSectionHeader: unknown section"
pprTypeAndSizeDecl :: CLabel -> Doc
pprTypeAndSizeDecl lbl
= empty
pprInstr :: Instr -> Doc
pprInstr (DELTA d)
= pprInstr (COMMENT (mkFastString ("\tdelta = " ++ show d)))
pprInstr (NEWBLOCK _)
= panic "PprMach.pprInstr: NEWBLOCK"
pprInstr (LDATA _ _)
= panic "PprMach.pprInstr: LDATA"
pprInstr (SPILL reg slot)
= hcat [
ptext (sLit "\tSPILL"),
char '\t',
pprReg reg,
comma,
ptext (sLit "SLOT") <> parens (int slot)]
pprInstr (RELOAD slot reg)
= hcat [
ptext (sLit "\tRELOAD"),
char '\t',
ptext (sLit "SLOT") <> parens (int slot),
comma,
pprReg reg]
pprInstr (LD size reg addr)
= hcat [
ptext (sLit "\tld"),
pprSize size,
char '\t',
pprReg reg,
comma,
pprAddr addr
]
pprInstr (LDA reg addr)
= hcat [
ptext (sLit "\tlda\t"),
pprReg reg,
comma,
pprAddr addr
]
pprInstr (LDAH reg addr)
= hcat [
ptext (sLit "\tldah\t"),
pprReg reg,
comma,
pprAddr addr
]
pprInstr (LDGP reg addr)
= hcat [
ptext (sLit "\tldgp\t"),
pprReg reg,
comma,
pprAddr addr
]
pprInstr (LDI size reg imm)
= hcat [
ptext (sLit "\tldi"),
pprSize size,
char '\t',
pprReg reg,
comma,
pprImm imm
]
pprInstr (ST size reg addr)
= hcat [
ptext (sLit "\tst"),
pprSize size,
char '\t',
pprReg reg,
comma,
pprAddr addr
]
pprInstr (CLR reg)
= hcat [
ptext (sLit "\tclr\t"),
pprReg reg
]
pprInstr (ABS size ri reg)
= hcat [
ptext (sLit "\tabs"),
pprSize size,
char '\t',
pprRI ri,
comma,
pprReg reg
]
pprInstr (NEG size ov ri reg)
= hcat [
ptext (sLit "\tneg"),
pprSize size,
if ov then ptext (sLit "v\t") else char '\t',
pprRI ri,
comma,
pprReg reg
]
pprInstr (ADD size ov reg1 ri reg2)
= hcat [
ptext (sLit "\tadd"),
pprSize size,
if ov then ptext (sLit "v\t") else char '\t',
pprReg reg1,
comma,
pprRI ri,
comma,
pprReg reg2
]
pprInstr (SADD size scale reg1 ri reg2)
= hcat [
ptext (case scale of {{-UNUSED:L -> (sLit "\ts4");-} Q -> (sLit "\ts8")}),
ptext (sLit "add"),
pprSize size,
char '\t',
pprReg reg1,
comma,
pprRI ri,
comma,
pprReg reg2
]
pprInstr (SUB size ov reg1 ri reg2)
= hcat [
ptext (sLit "\tsub"),
pprSize size,
if ov then ptext (sLit "v\t") else char '\t',
pprReg reg1,
comma,
pprRI ri,
comma,
pprReg reg2
]
pprInstr (SSUB size scale reg1 ri reg2)
= hcat [
ptext (case scale of {{-UNUSED:L -> (sLit "\ts4");-} Q -> (sLit "\ts8")}),
ptext (sLit "sub"),
pprSize size,
char '\t',
pprReg reg1,
comma,
pprRI ri,
comma,
pprReg reg2
]
pprInstr (MUL size ov reg1 ri reg2)
= hcat [
ptext (sLit "\tmul"),
pprSize size,
if ov then ptext (sLit "v\t") else char '\t',
pprReg reg1,
comma,
pprRI ri,
comma,
pprReg reg2
]
pprInstr (DIV size uns reg1 ri reg2)
= hcat [
ptext (sLit "\tdiv"),
pprSize size,
if uns then ptext (sLit "u\t") else char '\t',
pprReg reg1,
comma,
pprRI ri,
comma,
pprReg reg2
]
pprInstr (REM size uns reg1 ri reg2)
= hcat [
ptext (sLit "\trem"),
pprSize size,
if uns then ptext (sLit "u\t") else char '\t',
pprReg reg1,
comma,
pprRI ri,
comma,
pprReg reg2
]
pprInstr (NOT ri reg)
= hcat [
ptext (sLit "\tnot"),
char '\t',
pprRI ri,
comma,
pprReg reg
]
pprInstr (AND reg1 ri reg2) = pprRegRIReg (sLit "and") reg1 ri reg2
pprInstr (ANDNOT reg1 ri reg2) = pprRegRIReg (sLit "andnot") reg1 ri reg2
pprInstr (OR reg1 ri reg2) = pprRegRIReg (sLit "or") reg1 ri reg2
pprInstr (ORNOT reg1 ri reg2) = pprRegRIReg (sLit "ornot") reg1 ri reg2
pprInstr (XOR reg1 ri reg2) = pprRegRIReg (sLit "xor") reg1 ri reg2
pprInstr (XORNOT reg1 ri reg2) = pprRegRIReg (sLit "xornot") reg1 ri reg2
pprInstr (SLL reg1 ri reg2) = pprRegRIReg (sLit "sll") reg1 ri reg2
pprInstr (SRL reg1 ri reg2) = pprRegRIReg (sLit "srl") reg1 ri reg2
pprInstr (SRA reg1 ri reg2) = pprRegRIReg (sLit "sra") reg1 ri reg2
pprInstr (ZAP reg1 ri reg2) = pprRegRIReg (sLit "zap") reg1 ri reg2
pprInstr (ZAPNOT reg1 ri reg2) = pprRegRIReg (sLit "zapnot") reg1 ri reg2
pprInstr (NOP) = ptext (sLit "\tnop")
pprInstr (CMP cond reg1 ri reg2)
= hcat [
ptext (sLit "\tcmp"),
pprCond cond,
char '\t',
pprReg reg1,
comma,
pprRI ri,
comma,
pprReg reg2
]
pprInstr (FCLR reg)
= hcat [
ptext (sLit "\tfclr\t"),
pprReg reg
]
pprInstr (FABS reg1 reg2)
= hcat [
ptext (sLit "\tfabs\t"),
pprReg reg1,
comma,
pprReg reg2
]
pprInstr (FNEG size reg1 reg2)
= hcat [
ptext (sLit "\tneg"),
pprSize size,
char '\t',
pprReg reg1,
comma,
pprReg reg2
]
pprInstr (FADD size reg1 reg2 reg3) = pprSizeRegRegReg (sLit "add") size reg1 reg2 reg3
pprInstr (FDIV size reg1 reg2 reg3) = pprSizeRegRegReg (sLit "div") size reg1 reg2 reg3
pprInstr (FMUL size reg1 reg2 reg3) = pprSizeRegRegReg (sLit "mul") size reg1 reg2 reg3
pprInstr (FSUB size reg1 reg2 reg3) = pprSizeRegRegReg (sLit "sub") size reg1 reg2 reg3
pprInstr (CVTxy size1 size2 reg1 reg2)
= hcat [
ptext (sLit "\tcvt"),
pprSize size1,
case size2 of {Q -> ptext (sLit "qc"); _ -> pprSize size2},
char '\t',
pprReg reg1,
comma,
pprReg reg2
]
pprInstr (FCMP size cond reg1 reg2 reg3)
= hcat [
ptext (sLit "\tcmp"),
pprSize size,
pprCond cond,
char '\t',
pprReg reg1,
comma,
pprReg reg2,
comma,
pprReg reg3
]
pprInstr (FMOV reg1 reg2)
= hcat [
ptext (sLit "\tfmov\t"),
pprReg reg1,
comma,
pprReg reg2
]
pprInstr (BI ALWAYS reg lab) = pprInstr (BR lab)
pprInstr (BI NEVER reg lab) = empty
pprInstr (BI cond reg lab)
= hcat [
ptext (sLit "\tb"),
pprCond cond,
char '\t',
pprReg reg,
comma,
pprImm lab
]
pprInstr (BF cond reg lab)
= hcat [
ptext (sLit "\tfb"),
pprCond cond,
char '\t',
pprReg reg,
comma,
pprImm lab
]
pprInstr (BR lab)
= (<>) (ptext (sLit "\tbr\t")) (pprImm lab)
pprInstr (JMP reg addr hint)
= hcat [
ptext (sLit "\tjmp\t"),
pprReg reg,
comma,
pprAddr addr,
comma,
int hint
]
pprInstr (BSR imm n)
= (<>) (ptext (sLit "\tbsr\t")) (pprImm imm)
pprInstr (JSR reg addr n)
= hcat [
ptext (sLit "\tjsr\t"),