1 //===-- TargetMachine.cpp - General Target Information ---------------------==//
3 // This file describes the general parts of a Target machine.
4 // This file also implements MachineCacheInfo.
6 //===----------------------------------------------------------------------===//
8 #include "llvm/Target/TargetMachine.h"
9 #include "llvm/Target/MachineCacheInfo.h"
10 #include "llvm/Type.h"
12 //---------------------------------------------------------------------------
13 // class TargetMachine
16 // Machine description.
18 //---------------------------------------------------------------------------
21 // function TargetMachine::findOptimalStorageSize
24 // This default implementation assumes that all sub-word data items use
25 // space equal to optSizeForSubWordData, and all other primitive data
26 // items use space according to the type.
29 TargetMachine::findOptimalStorageSize(const Type* ty) const
31 switch(ty->getPrimitiveID())
36 case Type::UShortTyID:
38 return optSizeForSubWordData;
41 return DataLayout.getTypeSize(ty);
46 //---------------------------------------------------------------------------
47 // class MachineCacheInfo
50 // Describes properties of the target cache architecture.
51 //---------------------------------------------------------------------------
53 void MachineCacheInfo::Initialize() {
55 cacheLineSizes.push_back(16); cacheLineSizes.push_back(32);
56 cacheSizes.push_back(1 << 15); cacheSizes.push_back(1 << 20);
57 cacheAssoc.push_back(1); cacheAssoc.push_back(4);