2001-09-14 05:34:53 +00:00
|
|
|
//===-- TargetMachine.cpp - General Target Information ---------------------==//
|
2003-10-20 19:43:21 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file was developed by the LLVM research group and is distributed under
|
|
|
|
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2001-09-14 05:34:53 +00:00
|
|
|
//
|
|
|
|
// This file describes the general parts of a Target machine.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2001-07-21 12:42:08 +00:00
|
|
|
|
2002-10-28 23:55:33 +00:00
|
|
|
#include "llvm/Type.h"
|
2004-06-20 07:49:54 +00:00
|
|
|
#include "llvm/CodeGen/IntrinsicLowering.h"
|
2004-06-21 21:08:45 +00:00
|
|
|
#include "llvm/Target/TargetMachine.h"
|
2004-03-04 19:16:23 +00:00
|
|
|
#include "Support/CommandLine.h"
|
2003-12-28 21:23:38 +00:00
|
|
|
using namespace llvm;
|
2003-11-11 22:41:34 +00:00
|
|
|
|
2004-03-04 19:16:23 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// Command-line options that tend to be useful on more than one back-end.
|
|
|
|
//
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
bool PrintMachineCode;
|
2004-06-21 21:17:44 +00:00
|
|
|
bool NoFramePointerElim;
|
2004-03-04 19:16:23 +00:00
|
|
|
};
|
2004-06-21 21:08:45 +00:00
|
|
|
|
2004-03-04 19:16:23 +00:00
|
|
|
namespace {
|
|
|
|
cl::opt<bool, true> PrintCode("print-machineinstrs",
|
|
|
|
cl::desc("Print generated machine code"),
|
|
|
|
cl::location(PrintMachineCode), cl::init(false));
|
2004-06-21 21:08:45 +00:00
|
|
|
|
|
|
|
cl::opt<bool, true>
|
|
|
|
DisableFPElim("disable-fp-elim",
|
|
|
|
cl::desc("Disable frame pointer elimination optimization"),
|
2004-06-21 21:17:44 +00:00
|
|
|
cl::location(NoFramePointerElim),
|
|
|
|
cl::init(false));
|
2004-03-04 19:16:23 +00:00
|
|
|
};
|
|
|
|
|
2001-07-21 12:42:08 +00:00
|
|
|
//---------------------------------------------------------------------------
|
2003-12-28 21:23:38 +00:00
|
|
|
// TargetMachine Class
|
|
|
|
//
|
|
|
|
TargetMachine::TargetMachine(const std::string &name, IntrinsicLowering *il,
|
|
|
|
bool LittleEndian,
|
|
|
|
unsigned char PtrSize, unsigned char PtrAl,
|
|
|
|
unsigned char DoubleAl, unsigned char FloatAl,
|
|
|
|
unsigned char LongAl, unsigned char IntAl,
|
|
|
|
unsigned char ShortAl, unsigned char ByteAl)
|
|
|
|
: Name(name), DataLayout(name, LittleEndian,
|
|
|
|
PtrSize, PtrAl, DoubleAl, FloatAl, LongAl,
|
|
|
|
IntAl, ShortAl, ByteAl) {
|
|
|
|
IL = il ? il : new DefaultIntrinsicLowering();
|
|
|
|
}
|
2004-03-03 02:12:47 +00:00
|
|
|
TargetMachine::TargetMachine(const std::string &name, IntrinsicLowering *il,
|
|
|
|
const Module &M)
|
|
|
|
: Name(name), DataLayout(name, &M) {
|
|
|
|
IL = il ? il : new DefaultIntrinsicLowering();
|
|
|
|
}
|
2003-12-28 21:23:38 +00:00
|
|
|
|
|
|
|
TargetMachine::~TargetMachine() {
|
|
|
|
delete IL;
|
|
|
|
}
|
|
|
|
|