X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FTarget%2FSparcV9%2FSparcV9InstrSelectionSupport.h;h=9038a4db85ad937581c9a5a775931c953e626e13;hb=8f7802727f796b60fed79bb76f908ff289ad382c;hp=f62457cb494964cc1e2ad81d15f1d1e6dfd403f3;hpb=fee93865d687dc176e748698c58c87674c5c8af7;p=oota-llvm.git diff --git a/lib/Target/SparcV9/SparcV9InstrSelectionSupport.h b/lib/Target/SparcV9/SparcV9InstrSelectionSupport.h index f62457cb494..9038a4db85a 100644 --- a/lib/Target/SparcV9/SparcV9InstrSelectionSupport.h +++ b/lib/Target/SparcV9/SparcV9InstrSelectionSupport.h @@ -1,17 +1,13 @@ -// $Id$ -*-c++-*- -//*************************************************************************** -// File: -// SparcInstrSelectionSupport.h -// -// Purpose: -// -// History: -// 10/17/01 - Vikram Adve - Created -//**************************************************************************/ +//===-- llvm/CodeGen/SparcInstrSelectionSupport.h ---------------*- C++ -*-===// +// +// +// +//===----------------------------------------------------------------------===// #ifndef SPARC_INSTR_SELECTION_SUPPORT_h #define SPARC_INSTR_SELECTION_SUPPORT_h +#include "llvm/DerivedTypes.h" inline MachineOpCode ChooseLoadInstruction(const Type *DestTy) @@ -35,7 +31,6 @@ ChooseLoadInstruction(const Type *DestTy) return 0; } - inline MachineOpCode ChooseStoreInstruction(const Type *DestTy) { @@ -58,4 +53,28 @@ ChooseStoreInstruction(const Type *DestTy) return 0; } -#endif SPARC_INSTR_SELECTION_SUPPORT_h + +inline MachineOpCode +ChooseAddInstructionByType(const Type* resultType) +{ + MachineOpCode opCode = INVALID_OPCODE; + + if (resultType->isIntegral() || + isa(resultType) || + isa(resultType) || + resultType == Type::LabelTy) + { + opCode = ADD; + } + else + switch(resultType->getPrimitiveID()) + { + case Type::FloatTyID: opCode = FADDS; break; + case Type::DoubleTyID: opCode = FADDD; break; + default: assert(0 && "Invalid type for ADD instruction"); break; + } + + return opCode; +} + +#endif