blob: 848ddddd384ff4871c8d152bd95d369f1e8f3a66 [file] [log] [blame]
Vikram S. Advecc776df2001-10-18 00:03:20 +00001// $Id$ -*-c++-*-
2//***************************************************************************
3// File:
4// SparcInstrSelectionSupport.h
5//
6// Purpose:
7//
8// History:
9// 10/17/01 - Vikram Adve - Created
10//**************************************************************************/
11
12#ifndef SPARC_INSTR_SELECTION_SUPPORT_h
13#define SPARC_INSTR_SELECTION_SUPPORT_h
14
15
16inline MachineOpCode
17ChooseLoadInstruction(const Type *DestTy)
18{
19 switch (DestTy->getPrimitiveID()) {
20 case Type::BoolTyID:
21 case Type::UByteTyID: return LDUB;
22 case Type::SByteTyID: return LDSB;
23 case Type::UShortTyID: return LDUH;
24 case Type::ShortTyID: return LDSH;
25 case Type::UIntTyID: return LDUW;
26 case Type::IntTyID: return LDSW;
27 case Type::PointerTyID:
28 case Type::ULongTyID:
29 case Type::LongTyID: return LDX;
30 case Type::FloatTyID: return LD;
31 case Type::DoubleTyID: return LDD;
32 default: assert(0 && "Invalid type for Load instruction");
33 }
34
35 return 0;
36}
37
38
39inline MachineOpCode
40ChooseStoreInstruction(const Type *DestTy)
41{
42 switch (DestTy->getPrimitiveID()) {
43 case Type::BoolTyID:
44 case Type::UByteTyID:
45 case Type::SByteTyID: return STB;
46 case Type::UShortTyID:
47 case Type::ShortTyID: return STH;
48 case Type::UIntTyID:
49 case Type::IntTyID: return STW;
50 case Type::PointerTyID:
51 case Type::ULongTyID:
52 case Type::LongTyID: return STX;
53 case Type::FloatTyID: return ST;
54 case Type::DoubleTyID: return STD;
55 default: assert(0 && "Invalid type for Store instruction");
56 }
57
58 return 0;
59}
60
Chris Lattner7f74a562002-01-20 22:54:45 +000061#endif