aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/TargetMachine.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-12-28 21:23:38 +0000
committerChris Lattner <sabre@nondot.org>2003-12-28 21:23:38 +0000
commitf70e0c216c074bd2ae2b08178f5512849545db4e (patch)
treeecfce5ac045e092db18b62c4cc5f4903749e9e45 /lib/Target/TargetMachine.cpp
parent27490a6fcc8e24be0ee4ddfcdbdf7e9da9e5af41 (diff)
Clean up a lot of the code I added yesterday by exposing the IntrinsicLowering
implementation from the TargetMachine directly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10636 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/TargetMachine.cpp')
-rw-r--r--lib/Target/TargetMachine.cpp42
1 files changed, 25 insertions, 17 deletions
diff --git a/lib/Target/TargetMachine.cpp b/lib/Target/TargetMachine.cpp
index e7630b4ab3..51c1222ab6 100644
--- a/lib/Target/TargetMachine.cpp
+++ b/lib/Target/TargetMachine.cpp
@@ -15,20 +15,33 @@
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetCacheInfo.h"
#include "llvm/Type.h"
-
-namespace llvm {
+#include "llvm/IntrinsicLowering.h"
+using namespace llvm;
//---------------------------------------------------------------------------
-// class TargetMachine
-//
-// Purpose:
-// Machine description.
-//
-//---------------------------------------------------------------------------
+// TargetMachine Class
+//
+TargetMachine::TargetMachine(const std::string &name, IntrinsicLowering *il,
+ bool LittleEndian,
+ unsigned char PtrSize, unsigned char PtrAl,
+ unsigned char DoubleAl, unsigned char FloatAl,
+ unsigned char LongAl, unsigned char IntAl,
+ unsigned char ShortAl, unsigned char ByteAl)
+ : Name(name), DataLayout(name, LittleEndian,
+ PtrSize, PtrAl, DoubleAl, FloatAl, LongAl,
+ IntAl, ShortAl, ByteAl) {
+ IL = il ? il : new DefaultIntrinsicLowering();
+}
+
+
+
+TargetMachine::~TargetMachine() {
+ delete IL;
+}
+
+
-// function TargetMachine::findOptimalStorageSize
-//
unsigned TargetMachine::findOptimalStorageSize(const Type *Ty) const {
// All integer types smaller than ints promote to 4 byte integers.
if (Ty->isIntegral() && Ty->getPrimitiveSize() < 4)
@@ -39,11 +52,8 @@ unsigned TargetMachine::findOptimalStorageSize(const Type *Ty) const {
//---------------------------------------------------------------------------
-// class TargetCacheInfo
-//
-// Purpose:
-// Describes properties of the target cache architecture.
-//---------------------------------------------------------------------------
+// TargetCacheInfo Class
+//
void TargetCacheInfo::Initialize() {
numLevels = 2;
@@ -51,5 +61,3 @@ void TargetCacheInfo::Initialize() {
cacheSizes.push_back(1 << 15); cacheSizes.push_back(1 << 20);
cacheAssoc.push_back(1); cacheAssoc.push_back(4);
}
-
-} // End llvm namespace