Anton Korobeynikov | 5027652 | 2008-04-23 22:29:24 +0000 | [diff] [blame] | 1 | //===-- CPPTargetMachine.h - TargetMachine for the C++ backend --*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file declares the TargetMachine that is used by the C++ backend. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef CPPTARGETMACHINE_H |
| 15 | #define CPPTARGETMACHINE_H |
| 16 | |
| 17 | #include "llvm/Target/TargetMachine.h" |
| 18 | #include "llvm/Target/TargetData.h" |
| 19 | |
| 20 | namespace llvm { |
| 21 | |
Owen Anderson | cb37188 | 2008-08-21 00:14:44 +0000 | [diff] [blame^] | 22 | class raw_ostream; |
| 23 | |
Anton Korobeynikov | 5027652 | 2008-04-23 22:29:24 +0000 | [diff] [blame] | 24 | struct CPPTargetMachine : public TargetMachine { |
| 25 | const TargetData DataLayout; // Calculates type size & alignment |
| 26 | |
| 27 | CPPTargetMachine(const Module &M, const std::string &FS) |
| 28 | : DataLayout(&M) {} |
| 29 | |
| 30 | virtual bool WantsWholeFile() const { return true; } |
Owen Anderson | cb37188 | 2008-08-21 00:14:44 +0000 | [diff] [blame^] | 31 | virtual bool addPassesToEmitWholeFile(PassManager &PM, raw_ostream &Out, |
Anton Korobeynikov | 5027652 | 2008-04-23 22:29:24 +0000 | [diff] [blame] | 32 | CodeGenFileType FileType, bool Fast); |
| 33 | |
| 34 | // This class always works, but shouldn't be the default in most cases. |
| 35 | static unsigned getModuleMatchQuality(const Module &M) { return 1; } |
| 36 | |
| 37 | virtual const TargetData *getTargetData() const { return &DataLayout; } |
| 38 | }; |
| 39 | |
| 40 | } // End llvm namespace |
| 41 | |
| 42 | |
| 43 | #endif |