forked from OSchip/llvm-project
				
			Use the new TargetData class to factor out some of the shared code
between the static compilers and the interpreter. llvm-svn: 379
This commit is contained in:
		
							parent
							
								
									1cb56eda7f
								
							
						
					
					
						commit
						eae2201f08
					
				| 
						 | 
					@ -12,6 +12,7 @@
 | 
				
			||||||
#ifndef LLVM_CODEGEN_TARGETMACHINE_H
 | 
					#ifndef LLVM_CODEGEN_TARGETMACHINE_H
 | 
				
			||||||
#define LLVM_CODEGEN_TARGETMACHINE_H
 | 
					#define LLVM_CODEGEN_TARGETMACHINE_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "llvm/CodeGen/TargetData.h"
 | 
				
			||||||
#include "llvm/Support/NonCopyable.h"
 | 
					#include "llvm/Support/NonCopyable.h"
 | 
				
			||||||
#include "llvm/Support/DataTypes.h"
 | 
					#include "llvm/Support/DataTypes.h"
 | 
				
			||||||
#include <string>
 | 
					#include <string>
 | 
				
			||||||
| 
						 | 
					@ -147,13 +148,9 @@ public:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TargetMachine : public NonCopyableV {
 | 
					class TargetMachine : public NonCopyableV {
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
 | 
					  const string     TargetName;
 | 
				
			||||||
 | 
					  const TargetData DataLayout;               // Calculates type size & alignment
 | 
				
			||||||
  int              optSizeForSubWordData;
 | 
					  int              optSizeForSubWordData;
 | 
				
			||||||
  int		intSize;
 | 
					 | 
				
			||||||
  int		longSize;
 | 
					 | 
				
			||||||
  int		floatSize;
 | 
					 | 
				
			||||||
  int		doubleSize;
 | 
					 | 
				
			||||||
  int		longDoubleSize;
 | 
					 | 
				
			||||||
  int		pointerSize;
 | 
					 | 
				
			||||||
  int	           minMemOpWordSize;
 | 
					  int	           minMemOpWordSize;
 | 
				
			||||||
  int	           maxAtomicMemOpWordSize;
 | 
					  int	           maxAtomicMemOpWordSize;
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
| 
						 | 
					@ -161,9 +158,19 @@ public:
 | 
				
			||||||
  int		zeroRegNum;	// register that gives 0 if any (-1 if none)
 | 
					  int		zeroRegNum;	// register that gives 0 if any (-1 if none)
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  /*ctor*/		TargetMachine	(MachineInstrInfo* mii)
 | 
					  TargetMachine(const string &targetname, MachineInstrInfo* mii,
 | 
				
			||||||
						: machineInstrInfo(mii) {}
 | 
							unsigned char PtrSize = 8, unsigned char PtrAl = 8,
 | 
				
			||||||
  /*dtor*/ virtual	~TargetMachine	() {}
 | 
							unsigned char DoubleAl = 8, unsigned char FloatAl = 4,
 | 
				
			||||||
 | 
							unsigned char LongAl = 8, unsigned char IntAl = 4,
 | 
				
			||||||
 | 
							unsigned char ShortAl = 2, unsigned char ByteAl = 1)
 | 
				
			||||||
 | 
					    : TargetName(targetname), DataLayout(targetname, PtrSize, PtrAl,
 | 
				
			||||||
 | 
										 DoubleAl, FloatAl, LongAl, IntAl,
 | 
				
			||||||
 | 
										 ShortAl, ByteAl),
 | 
				
			||||||
 | 
					      machineInstrInfo(mii) {
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  virtual ~TargetMachine() {
 | 
				
			||||||
 | 
					    delete machineInstrInfo;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  const MachineInstrInfo& getInstrInfo	() const { return *machineInstrInfo; }
 | 
					  const MachineInstrInfo& getInstrInfo	() const { return *machineInstrInfo; }
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
| 
						 | 
					@ -171,17 +178,11 @@ public:
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  virtual unsigned int	findOptimalStorageSize	(const Type* ty) const;
 | 
					  virtual unsigned int	findOptimalStorageSize	(const Type* ty) const;
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  virtual unsigned int*	findOptimalMemberOffsets(const StructType* stype)const;
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
  // Description of machine instructions
 | 
					  // Description of machine instructions
 | 
				
			||||||
  // Protect so that subclass can control alloc/dealloc
 | 
					  // Protect so that subclass can control alloc/dealloc
 | 
				
			||||||
  MachineInstrInfo* machineInstrInfo;
 | 
					  MachineInstrInfo* machineInstrInfo;
 | 
				
			||||||
  // MachineSchedInfo* machineSchedInfo;
 | 
					  // MachineSchedInfo* machineSchedInfo;
 | 
				
			||||||
  
 | 
					 | 
				
			||||||
private:
 | 
					 | 
				
			||||||
  /*ctor*/		TargetMachine	();	// disable
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue