diff options
| author | Vikram S. Adve <vadve@cs.uiuc.edu> | 2001-10-18 00:03:20 +0000 |
|---|---|---|
| committer | Vikram S. Adve <vadve@cs.uiuc.edu> | 2001-10-18 00:03:20 +0000 |
| commit | cc776df39c48cda4a23f6ff2b075eeaad2709eb4 (patch) | |
| tree | 12b1d96d4b8bb3eaa07ff565f685b5fc078f59a0 /llvm/lib | |
| parent | 01e57a481e7c8cbfce9106bec9e721f16a935d27 (diff) | |
| download | bcm5719-llvm-cc776df39c48cda4a23f6ff2b075eeaad2709eb4.tar.gz bcm5719-llvm-cc776df39c48cda4a23f6ff2b075eeaad2709eb4.zip | |
Sparc-specific code shared between local files.
llvm-svn: 864
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/Sparc/SparcInstrSelectionSupport.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/llvm/lib/Target/Sparc/SparcInstrSelectionSupport.h b/llvm/lib/Target/Sparc/SparcInstrSelectionSupport.h new file mode 100644 index 00000000000..f62457cb494 --- /dev/null +++ b/llvm/lib/Target/Sparc/SparcInstrSelectionSupport.h @@ -0,0 +1,61 @@ +// $Id$ -*-c++-*- +//*************************************************************************** +// File: +// SparcInstrSelectionSupport.h +// +// Purpose: +// +// History: +// 10/17/01 - Vikram Adve - Created +//**************************************************************************/ + +#ifndef SPARC_INSTR_SELECTION_SUPPORT_h +#define SPARC_INSTR_SELECTION_SUPPORT_h + + +inline MachineOpCode +ChooseLoadInstruction(const Type *DestTy) +{ + switch (DestTy->getPrimitiveID()) { + case Type::BoolTyID: + case Type::UByteTyID: return LDUB; + case Type::SByteTyID: return LDSB; + case Type::UShortTyID: return LDUH; + case Type::ShortTyID: return LDSH; + case Type::UIntTyID: return LDUW; + case Type::IntTyID: return LDSW; + case Type::PointerTyID: + case Type::ULongTyID: + case Type::LongTyID: return LDX; + case Type::FloatTyID: return LD; + case Type::DoubleTyID: return LDD; + default: assert(0 && "Invalid type for Load instruction"); + } + + return 0; +} + + +inline MachineOpCode +ChooseStoreInstruction(const Type *DestTy) +{ + switch (DestTy->getPrimitiveID()) { + case Type::BoolTyID: + case Type::UByteTyID: + case Type::SByteTyID: return STB; + case Type::UShortTyID: + case Type::ShortTyID: return STH; + case Type::UIntTyID: + case Type::IntTyID: return STW; + case Type::PointerTyID: + case Type::ULongTyID: + case Type::LongTyID: return STX; + case Type::FloatTyID: return ST; + case Type::DoubleTyID: return STD; + default: assert(0 && "Invalid type for Store instruction"); + } + + return 0; +} + +#endif SPARC_INSTR_SELECTION_SUPPORT_h |

