2001-09-14 07:34:53 +02:00
|
|
|
//===-- TargetMachine.cpp - General Target Information ---------------------==//
|
|
|
|
//
|
|
|
|
// This file describes the general parts of a Target machine.
|
2002-12-29 03:50:35 +01:00
|
|
|
// This file also implements TargetCacheInfo.
|
2001-09-14 07:34:53 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2001-07-21 14:42:08 +02:00
|
|
|
|
2001-11-09 03:20:18 +01:00
|
|
|
#include "llvm/Target/TargetMachine.h"
|
2002-12-29 03:50:35 +01:00
|
|
|
#include "llvm/Target/TargetCacheInfo.h"
|
2002-10-29 00:55:33 +01:00
|
|
|
#include "llvm/Type.h"
|
2002-09-20 02:52:43 +02:00
|
|
|
|
2001-07-21 14:42:08 +02:00
|
|
|
//---------------------------------------------------------------------------
|
2001-07-28 06:09:37 +02:00
|
|
|
// class TargetMachine
|
2001-07-21 14:42:08 +02:00
|
|
|
//
|
|
|
|
// Purpose:
|
2001-07-28 06:09:37 +02:00
|
|
|
// Machine description.
|
|
|
|
//
|
2001-07-21 14:42:08 +02:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2001-09-18 14:58:33 +02:00
|
|
|
|
2001-07-28 06:09:37 +02:00
|
|
|
// function TargetMachine::findOptimalStorageSize
|
|
|
|
//
|
|
|
|
// Purpose:
|
|
|
|
// This default implementation assumes that all sub-word data items use
|
|
|
|
// space equal to optSizeForSubWordData, and all other primitive data
|
|
|
|
// items use space according to the type.
|
|
|
|
//
|
2002-10-29 22:47:50 +01:00
|
|
|
unsigned TargetMachine::findOptimalStorageSize(const Type *Ty) const {
|
|
|
|
// Round integral values smaller than SubWordDataSize up to SubWordDataSize
|
|
|
|
if (Ty->isIntegral() &&
|
|
|
|
Ty->getPrimitiveSize() < DataLayout.getSubWordDataSize())
|
|
|
|
return DataLayout.getSubWordDataSize();
|
|
|
|
|
|
|
|
return DataLayout.getTypeSize(Ty);
|
2001-07-21 14:42:08 +02:00
|
|
|
}
|
|
|
|
|
2001-07-28 06:09:37 +02:00
|
|
|
|
2001-11-09 03:20:18 +01:00
|
|
|
//---------------------------------------------------------------------------
|
2002-12-29 03:50:35 +01:00
|
|
|
// class TargetCacheInfo
|
2001-11-09 03:20:18 +01:00
|
|
|
//
|
|
|
|
// Purpose:
|
|
|
|
// Describes properties of the target cache architecture.
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2002-12-29 03:50:35 +01:00
|
|
|
void TargetCacheInfo::Initialize() {
|
2001-11-09 03:20:18 +01:00
|
|
|
numLevels = 2;
|
|
|
|
cacheLineSizes.push_back(16); cacheLineSizes.push_back(32);
|
|
|
|
cacheSizes.push_back(1 << 15); cacheSizes.push_back(1 << 20);
|
|
|
|
cacheAssoc.push_back(1); cacheAssoc.push_back(4);
|
|
|
|
}
|