mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-01 15:11:24 +00:00
242a8086aa
-- correct sign extensions for integer casts and for shift-by-constant instructions generated for integer multiply -- passing FP arguments to functions with more than 6 arguments -- passing FP arguments to varargs functions -- passing FP arguments to functions with no prototypes -- incorrect stack frame size when padding a section -- folding getelementptr operations with mixed array and struct indexes -- use uint64_t instead of uint for constant offsets in mem operands -- incorrect coloring for CC registers (both int and FP): interferences were being completely ignored for int CC and were considered but no spills were marked for fp CC! Also some code improvements: -- better interface to generating machine instr for common cases (many places still need to be updated to use this interface) -- annotations on MachineInstr to communicate information from one codegen phase to another (now used to pass information about CALL/JMPLCALL operands from selection to register allocation) -- all sizes and offests in class TargetData are uint64_t instead of uint git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2640 91177308-0d34-0410-b5e6-96231b3b80d8
89 lines
2.1 KiB
C++
89 lines
2.1 KiB
C++
// $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
|
|
|
|
#include "llvm/DerivedTypes.h"
|
|
#include "llvm/Value.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;
|
|
}
|
|
|
|
|
|
inline MachineOpCode
|
|
ChooseAddInstructionByType(const Type* resultType)
|
|
{
|
|
MachineOpCode opCode = INVALID_OPCODE;
|
|
|
|
if (resultType->isIntegral() ||
|
|
isa<PointerType>(resultType) ||
|
|
isa<FunctionType>(resultType) ||
|
|
resultType == Type::LabelTy ||
|
|
resultType == Type::BoolTy)
|
|
{
|
|
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
|