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.
28 unsigned TargetMachine::findOptimalStorageSize(const Type *Ty) const {
29 // Round integral values smaller than SubWordDataSize up to SubWordDataSize
30 if (Ty->isIntegral() &&
31 Ty->getPrimitiveSize() < DataLayout.getSubWordDataSize())
32 return DataLayout.getSubWordDataSize();
34 return DataLayout.getTypeSize(Ty);
38 //---------------------------------------------------------------------------
39 // class MachineCacheInfo
42 // Describes properties of the target cache architecture.
43 //---------------------------------------------------------------------------
45 void MachineCacheInfo::Initialize() {
47 cacheLineSizes.push_back(16); cacheLineSizes.push_back(32);
48 cacheSizes.push_back(1 << 15); cacheSizes.push_back(1 << 20);
49 cacheAssoc.push_back(1); cacheAssoc.push_back(4);