[llvm-commits] CVS: llvm/lib/Target/TargetMachine.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Dec 28 15:24:14 PST 2003


Changes in directory llvm/lib/Target:

TargetMachine.cpp updated: 1.20 -> 1.21

---
Log message:

Clean up a lot of the code I added yesterday by exposing the IntrinsicLowering
implementation from the TargetMachine directly.



---
Diffs of the changes:  (+25 -17)

Index: llvm/lib/Target/TargetMachine.cpp
diff -u llvm/lib/Target/TargetMachine.cpp:1.20 llvm/lib/Target/TargetMachine.cpp:1.21
--- llvm/lib/Target/TargetMachine.cpp:1.20	Tue Nov 11 16:41:33 2003
+++ llvm/lib/Target/TargetMachine.cpp	Sun Dec 28 15:23:38 2003
@@ -15,20 +15,33 @@
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetCacheInfo.h"
 #include "llvm/Type.h"
+#include "llvm/IntrinsicLowering.h"
+using namespace llvm;
 
-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 @@
 
 
 //---------------------------------------------------------------------------
-// class TargetCacheInfo 
-// 
-// Purpose:
-//   Describes properties of the target cache architecture.
-//---------------------------------------------------------------------------
+// TargetCacheInfo Class
+//
 
 void TargetCacheInfo::Initialize() {
   numLevels = 2;
@@ -51,5 +61,3 @@
   cacheSizes.push_back(1 << 15); cacheSizes.push_back(1 << 20);
   cacheAssoc.push_back(1);       cacheAssoc.push_back(4);
 }
-
-} // End llvm namespace





More information about the llvm-commits mailing list