Changes For Bug 352
[oota-llvm.git] / lib / Target / TargetMachine.cpp
1 //===-- TargetMachine.cpp - General Target Information ---------------------==//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 // 
8 //===----------------------------------------------------------------------===//
9 //
10 // This file describes the general parts of a Target machine.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "llvm/Target/TargetMachine.h"
15 #include "llvm/Type.h"
16 #include "llvm/CodeGen/IntrinsicLowering.h"
17 #include "llvm/Support/CommandLine.h"
18 using namespace llvm;
19
20 //---------------------------------------------------------------------------
21 // Command-line options that tend to be useful on more than one back-end.
22 //
23
24 namespace llvm {
25   bool PrintMachineCode;
26   bool NoFramePointerElim;
27 };
28 namespace {
29   cl::opt<bool, true> PrintCode("print-machineinstrs",
30     cl::desc("Print generated machine code"),
31     cl::location(PrintMachineCode), cl::init(false));
32
33   cl::opt<bool, true> 
34     DisableFPElim("disable-fp-elim",
35                   cl::desc("Disable frame pointer elimination optimization"),
36                   cl::location(NoFramePointerElim),
37                   cl::init(false));
38 };
39
40 //---------------------------------------------------------------------------
41 // TargetMachine Class
42 //
43 TargetMachine::TargetMachine(const std::string &name, IntrinsicLowering *il,
44                              bool LittleEndian,
45                              unsigned char PtrSize, unsigned char PtrAl,
46                              unsigned char DoubleAl, unsigned char FloatAl,
47                              unsigned char LongAl, unsigned char IntAl,
48                              unsigned char ShortAl, unsigned char ByteAl,
49                              unsigned char BoolAl)
50   : Name(name), DataLayout(name, LittleEndian,
51                            PtrSize, PtrAl, DoubleAl, FloatAl, LongAl,
52                            IntAl, ShortAl, ByteAl, BoolAl) {
53   IL = il ? il : new DefaultIntrinsicLowering();
54 }
55
56 TargetMachine::TargetMachine(const std::string &name, IntrinsicLowering *il,
57                              const TargetData &TD)
58   : Name(name), DataLayout(TD) {
59   IL = il ? il : new DefaultIntrinsicLowering();
60 }
61
62 TargetMachine::TargetMachine(const std::string &name, IntrinsicLowering *il,
63                              const Module &M)
64   : Name(name), DataLayout(name, &M) {
65   IL = il ? il : new DefaultIntrinsicLowering();
66 }
67
68 TargetMachine::~TargetMachine() {
69   delete IL;
70 }
71