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 | fee93865d687dc176e748698c58c87674c5c8af7 (patch) | |
tree | a42dab2d71d05ddc0cf15bac0a41487d0b64013a /lib | |
parent | 4df35a2ce3507b85a4d0966f2ce0a92abe3f5aab (diff) | |
download | external_llvm-fee93865d687dc176e748698c58c87674c5c8af7.zip external_llvm-fee93865d687dc176e748698c58c87674c5c8af7.tar.gz external_llvm-fee93865d687dc176e748698c58c87674c5c8af7.tar.bz2 |
Sparc-specific code shared between local files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@864 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/SparcV9/SparcV9InstrSelectionSupport.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/lib/Target/SparcV9/SparcV9InstrSelectionSupport.h b/lib/Target/SparcV9/SparcV9InstrSelectionSupport.h new file mode 100644 index 0000000..f62457c --- /dev/null +++ b/lib/Target/SparcV9/SparcV9InstrSelectionSupport.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 |