LLVM API Documentation

CTargetMachine.h

Go to the documentation of this file.
00001 //===-- CTargetMachine.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 CTARGETMACHINE_H
00015 #define CTARGETMACHINE_H
00016 
00017 #include "llvm/Target/TargetMachine.h"
00018 #include "llvm/Target/TargetData.h"
00019 
00020 namespace llvm {
00021 
00022 struct CTargetMachine : public TargetMachine {
00023   const TargetData DataLayout;       // Calculates type size & alignment
00024 
00025   CTargetMachine(const Module &M, const std::string &FS)
00026     : DataLayout(&M) {}
00027 
00028   virtual bool WantsWholeFile() const { return true; }
00029   virtual bool addPassesToEmitWholeFile(PassManager &PM, raw_ostream &Out,
00030                                         CodeGenFileType FileType, bool Fast);
00031 
00032   // This class always works, but shouldn't be the default in most cases.
00033   static unsigned getModuleMatchQuality(const Module &M) { return 1; }
00034   
00035   virtual const TargetData *getTargetData() const { return &DataLayout; }
00036 };
00037 
00038 } // End llvm namespace
00039 
00040 
00041 #endif