diff options
author | Chris Lattner <sabre@nondot.org> | 2001-09-14 20:00:02 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-09-14 20:00:02 +0000 |
commit | 7163447b9df1e011503961884352d25db25d2076 (patch) | |
tree | 9205fb3d6b4b29de2bdecca30da2166803c1f25f /lib | |
parent | ffe335ace15373e34f7ca28a4b045c1d71f70a26 (diff) |
Add support for loading and storing pointers...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@575 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/SparcV9/SparcV9InstrSelection.cpp | 76 |
1 files changed, 34 insertions, 42 deletions
diff --git a/lib/Target/SparcV9/SparcV9InstrSelection.cpp b/lib/Target/SparcV9/SparcV9InstrSelection.cpp index fde7282e85..d94e07df7f 100644 --- a/lib/Target/SparcV9/SparcV9InstrSelection.cpp +++ b/lib/Target/SparcV9/SparcV9InstrSelection.cpp @@ -821,53 +821,45 @@ CreateDivConstInstruction(const InstructionNode* instrNode, } -static inline MachineOpCode -ChooseLoadInstruction(const Type* resultType) -{ - MachineOpCode opCode = INVALID_OPCODE; - - switch (resultType->getPrimitiveID()) - { - case Type::BoolTyID: opCode = LDUB; break; - case Type::UByteTyID: opCode = LDUB; break; - case Type::SByteTyID: opCode = LDSB; break; - case Type::UShortTyID: opCode = LDUH; break; - case Type::ShortTyID: opCode = LDSH; break; - case Type::UIntTyID: opCode = LDUW; break; - case Type::IntTyID: opCode = LDSW; break; - case Type::ULongTyID: - case Type::LongTyID: opCode = LDX; break; - case Type::FloatTyID: opCode = LD; break; - case Type::DoubleTyID: opCode = LDD; break; - default: assert(0 && "Invalid type for Load instruction"); break; - } +static 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 opCode; + return 0; } -static inline MachineOpCode -ChooseStoreInstruction(const Type* valueType) -{ - MachineOpCode opCode = INVALID_OPCODE; - - switch (valueType->getPrimitiveID()) - { - case Type::BoolTyID: - case Type::UByteTyID: - case Type::SByteTyID: opCode = STB; break; - case Type::UShortTyID: - case Type::ShortTyID: opCode = STH; break; - case Type::UIntTyID: - case Type::IntTyID: opCode = STW; break; - case Type::ULongTyID: - case Type::LongTyID: opCode = STX; break; - case Type::FloatTyID: opCode = ST; break; - case Type::DoubleTyID: opCode = STD; break; - default: assert(0 && "Invalid type for Store instruction"); break; - } +static 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 opCode; + return 0; } |