LLVM API Documentation

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

TargetMachine.cpp

Go to the documentation of this file.
00001 //===-- TargetMachine.cpp - General Target Information ---------------------==//
00002 // 
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file was developed by the LLVM research group and is distributed under
00006 // the University of Illinois Open Source License. See LICENSE.TXT for details.
00007 // 
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file describes the general parts of a Target machine.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #include "llvm/Target/TargetMachine.h"
00015 #include "llvm/Type.h"
00016 #include "llvm/CodeGen/IntrinsicLowering.h"
00017 #include "llvm/Support/CommandLine.h"
00018 using namespace llvm;
00019 
00020 //---------------------------------------------------------------------------
00021 // Command-line options that tend to be useful on more than one back-end.
00022 //
00023 
00024 namespace llvm {
00025   bool PrintMachineCode;
00026   bool NoFramePointerElim;
00027 };
00028 namespace {
00029   cl::opt<bool, true> PrintCode("print-machineinstrs",
00030     cl::desc("Print generated machine code"),
00031     cl::location(PrintMachineCode), cl::init(false));
00032 
00033   cl::opt<bool, true> 
00034     DisableFPElim("disable-fp-elim",
00035                   cl::desc("Disable frame pointer elimination optimization"),
00036                   cl::location(NoFramePointerElim),
00037                   cl::init(false));
00038 };
00039 
00040 //---------------------------------------------------------------------------
00041 // TargetMachine Class
00042 //
00043 TargetMachine::TargetMachine(const std::string &name, IntrinsicLowering *il,
00044                              bool LittleEndian,
00045                              unsigned char PtrSize, unsigned char PtrAl,
00046                              unsigned char DoubleAl, unsigned char FloatAl,
00047                              unsigned char LongAl, unsigned char IntAl,
00048                              unsigned char ShortAl, unsigned char ByteAl,
00049                              unsigned char BoolAl)
00050   : Name(name), DataLayout(name, LittleEndian,
00051                            PtrSize, PtrAl, DoubleAl, FloatAl, LongAl,
00052                            IntAl, ShortAl, ByteAl, BoolAl) {
00053   IL = il ? il : new DefaultIntrinsicLowering();
00054 }
00055 
00056 TargetMachine::TargetMachine(const std::string &name, IntrinsicLowering *il,
00057                              const TargetData &TD)
00058   : Name(name), DataLayout(TD) {
00059   IL = il ? il : new DefaultIntrinsicLowering();
00060 }
00061 
00062 TargetMachine::TargetMachine(const std::string &name, IntrinsicLowering *il,
00063                              const Module &M)
00064   : Name(name), DataLayout(name, &M) {
00065   IL = il ? il : new DefaultIntrinsicLowering();
00066 }
00067 
00068 TargetMachine::~TargetMachine() {
00069   delete IL;
00070 }
00071