LLVM API Documentation
00001 //===-- CPPTargetMachine.h - TargetMachine for the C++ backend --*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file declares the TargetMachine that is used by the C++ backend. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #ifndef CPPTARGETMACHINE_H 00015 #define CPPTARGETMACHINE_H 00016 00017 #include "llvm/Target/TargetMachine.h" 00018 #include "llvm/Target/TargetData.h" 00019 00020 namespace llvm { 00021 00022 class raw_ostream; 00023 00024 struct CPPTargetMachine : public TargetMachine { 00025 const TargetData DataLayout; // Calculates type size & alignment 00026 00027 CPPTargetMachine(const Module &M, const std::string &FS) 00028 : DataLayout(&M) {} 00029 00030 virtual bool WantsWholeFile() const { return true; } 00031 virtual bool addPassesToEmitWholeFile(PassManager &PM, raw_ostream &Out, 00032 CodeGenFileType FileType, bool Fast); 00033 00034 // This class always works, but shouldn't be the default in most cases. 00035 static unsigned getModuleMatchQuality(const Module &M) { return 1; } 00036 00037 virtual const TargetData *getTargetData() const { return &DataLayout; } 00038 }; 00039 00040 } // End llvm namespace 00041 00042 00043 #endif