Make pattern isel default for ppc
[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   bool NoExcessFPPrecision;
28   int  PatternISelTriState;
29 };
30 namespace {
31   cl::opt<bool, true> PrintCode("print-machineinstrs",
32     cl::desc("Print generated machine code"),
33     cl::location(PrintMachineCode), cl::init(false));
34
35   cl::opt<bool, true> 
36     DisableFPElim("disable-fp-elim",
37                   cl::desc("Disable frame pointer elimination optimization"),
38                   cl::location(NoFramePointerElim),
39                   cl::init(false));
40   cl::opt<bool, true>
41   DisableExcessPrecision("disable-excess-fp-precision",
42                cl::desc("Disable optimizations that may increase FP precision"),
43                cl::location(NoExcessFPPrecision),
44                cl::init(false));
45   cl::opt<int, true> PatternISel("enable-pattern-isel",
46                     cl::desc("sets the pattern ISel off(0), on(1), default(2)"),
47                     cl::location(PatternISelTriState),
48                     cl::init(2));
49 };
50
51 //---------------------------------------------------------------------------
52 // TargetMachine Class
53 //
54 TargetMachine::TargetMachine(const std::string &name, IntrinsicLowering *il,
55                              bool LittleEndian,
56                              unsigned char PtrSize, unsigned char PtrAl,
57                              unsigned char DoubleAl, unsigned char FloatAl,
58                              unsigned char LongAl, unsigned char IntAl,
59                              unsigned char ShortAl, unsigned char ByteAl,
60                              unsigned char BoolAl)
61   : Name(name), DataLayout(name, LittleEndian,
62                            PtrSize, PtrAl, DoubleAl, FloatAl, LongAl,
63                            IntAl, ShortAl, ByteAl, BoolAl) {
64   IL = il ? il : new DefaultIntrinsicLowering();
65 }
66
67 TargetMachine::TargetMachine(const std::string &name, IntrinsicLowering *il,
68                              const TargetData &TD)
69   : Name(name), DataLayout(TD) {
70   IL = il ? il : new DefaultIntrinsicLowering();
71 }
72
73 TargetMachine::TargetMachine(const std::string &name, IntrinsicLowering *il,
74                              const Module &M)
75   : Name(name), DataLayout(name, &M) {
76   IL = il ? il : new DefaultIntrinsicLowering();
77 }
78
79 TargetMachine::~TargetMachine() {
80   delete IL;
81 }
82