1 //===-- TargetMachine.cpp - General Target Information ---------------------==//
3 // This file describes the general parts of a Target machine.
4 // This file also implements TargetCacheInfo.
6 //===----------------------------------------------------------------------===//
8 #include "llvm/Target/TargetMachine.h"
9 #include "llvm/Target/TargetCacheInfo.h"
10 #include "llvm/Type.h"
12 //---------------------------------------------------------------------------
13 // class TargetMachine
16 // Machine description.
18 //---------------------------------------------------------------------------
21 // function TargetMachine::findOptimalStorageSize
23 unsigned TargetMachine::findOptimalStorageSize(const Type *Ty) const {
24 // All integer types smaller than ints promote to 4 byte integers.
25 if (Ty->isIntegral() && Ty->getPrimitiveSize() < 4)
28 return DataLayout.getTypeSize(Ty);
32 //---------------------------------------------------------------------------
33 // class TargetCacheInfo
36 // Describes properties of the target cache architecture.
37 //---------------------------------------------------------------------------
39 void TargetCacheInfo::Initialize() {
41 cacheLineSizes.push_back(16); cacheLineSizes.push_back(32);
42 cacheSizes.push_back(1 << 15); cacheSizes.push_back(1 << 20);
43 cacheAssoc.push_back(1); cacheAssoc.push_back(4);