[llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaSubtarget.cpp AlphaSubtarget.h AlphaAsmPrinter.cpp AlphaISelLowering.cpp AlphaISelPattern.cpp AlphaTargetMachine.cpp AlphaTargetMachine.h
Andrew Lenharth
alenhar2 at cs.uiuc.edu
Thu Sep 29 15:55:07 PDT 2005
Changes in directory llvm/lib/Target/Alpha:
AlphaSubtarget.cpp added (r1.1)
AlphaSubtarget.h added (r1.1)
AlphaAsmPrinter.cpp updated: 1.19 -> 1.20
AlphaISelLowering.cpp updated: 1.5 -> 1.6
AlphaISelPattern.cpp updated: 1.171 -> 1.172
AlphaTargetMachine.cpp updated: 1.12 -> 1.13
AlphaTargetMachine.h updated: 1.9 -> 1.10
---
Log message:
begining alpha subtarget support
---
Diffs of the changes: (+86 -19)
AlphaAsmPrinter.cpp | 9 +++------
AlphaISelLowering.cpp | 4 +---
AlphaISelPattern.cpp | 11 +++--------
AlphaSubtarget.cpp | 28 ++++++++++++++++++++++++++++
AlphaSubtarget.h | 42 ++++++++++++++++++++++++++++++++++++++++++
AlphaTargetMachine.cpp | 8 ++++++--
AlphaTargetMachine.h | 3 +++
7 files changed, 86 insertions(+), 19 deletions(-)
Index: llvm/lib/Target/Alpha/AlphaSubtarget.cpp
diff -c /dev/null llvm/lib/Target/Alpha/AlphaSubtarget.cpp:1.1
*** /dev/null Thu Sep 29 17:55:06 2005
--- llvm/lib/Target/Alpha/AlphaSubtarget.cpp Thu Sep 29 17:54:56 2005
***************
*** 0 ****
--- 1,28 ----
+ //===- AlphaSubtarget.cpp - Alpha Subtarget Information ---------*- C++ -*-===//
+ //
+ // The LLVM Compiler Infrastructure
+ //
+ // This file was developed by Andrew Lenharth and is distributed under the
+ // University of Illinois Open Source License. See LICENSE.TXT for details.
+ //
+ //===----------------------------------------------------------------------===//
+ //
+ // This file implements the Alpha specific subclass of TargetSubtarget.
+ //
+ //===----------------------------------------------------------------------===//
+
+ #include "AlphaSubtarget.h"
+ #include "Alpha.h"
+ #include "llvm/Module.h"
+ #include "llvm/Support/CommandLine.h"
+ #include "llvm/Target/SubtargetFeature.h"
+
+ using namespace llvm;
+
+ //"alphaev67-unknown-linux-gnu"
+
+ AlphaSubtarget::AlphaSubtarget(const Module &M, const std::string &FS)
+ :HasF2I(false), HasCT(false)
+ {
+ //TODO: figure out host
+ }
Index: llvm/lib/Target/Alpha/AlphaSubtarget.h
diff -c /dev/null llvm/lib/Target/Alpha/AlphaSubtarget.h:1.1
*** /dev/null Thu Sep 29 17:55:07 2005
--- llvm/lib/Target/Alpha/AlphaSubtarget.h Thu Sep 29 17:54:56 2005
***************
*** 0 ****
--- 1,42 ----
+ //=====-- AlphaSubtarget.h - Define Subtarget for the Alpha --*- C++ -*--====//
+ //
+ // The LLVM Compiler Infrastructure
+ //
+ // This file was developed by Andrew Lenharth and is distributed under the
+ // University of Illinois Open Source License. See LICENSE.TXT for details.
+ //
+ //===----------------------------------------------------------------------===//
+ //
+ // This file declares the Alpha specific subclass of TargetSubtarget.
+ //
+ //===----------------------------------------------------------------------===//
+
+ #ifndef ALPHASUBTARGET_H
+ #define ALPHASUBTARGET_H
+
+ #include "llvm/Target/TargetSubtarget.h"
+
+ #include <string>
+
+ namespace llvm {
+ class Module;
+
+ class AlphaSubtarget : public TargetSubtarget {
+ protected:
+
+ /// Used by the ISel to turn in optimizations for POWER4-derived architectures
+ bool HasF2I;
+ bool HasCT;
+
+ public:
+ /// This constructor initializes the data members to match that
+ /// of the specified module.
+ ///
+ AlphaSubtarget(const Module &M, const std::string &FS);
+
+ bool hasF2I() const { return HasF2I; }
+ bool hasCT() const { return HasCT; }
+ };
+ } // End llvm namespace
+
+ #endif
Index: llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp
diff -u llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.19 llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.20
--- llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.19 Fri Aug 12 11:13:43 2005
+++ llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp Thu Sep 29 17:54:56 2005
@@ -14,6 +14,7 @@
#include "Alpha.h"
#include "AlphaInstrInfo.h"
+#include "AlphaTargetMachine.h"
#include "llvm/Module.h"
#include "llvm/Type.h"
#include "llvm/Assembly/Writer.h"
@@ -29,11 +30,6 @@
using namespace llvm;
-namespace llvm {
- extern cl::opt<bool> EnableAlphaFTOI;
- extern cl::opt<bool> EnableAlphaCT;
-}
-
namespace {
Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed");
@@ -235,7 +231,8 @@
bool AlphaAsmPrinter::doInitialization(Module &M)
{
AsmPrinter::doInitialization(M);
- if(EnableAlphaFTOI || EnableAlphaCT)
+ if(TM.getSubtarget<AlphaSubtarget>().hasF2I()
+ || TM.getSubtarget<AlphaSubtarget>().hasCT())
O << "\t.arch ev6\n";
else
O << "\t.arch ev56\n";
Index: llvm/lib/Target/Alpha/AlphaISelLowering.cpp
diff -u llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.5 llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.6
--- llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.5 Wed Sep 28 17:29:17 2005
+++ llvm/lib/Target/Alpha/AlphaISelLowering.cpp Thu Sep 29 17:54:56 2005
@@ -27,8 +27,6 @@
namespace llvm {
extern cl::opt<bool> EnableAlphaIDIV;
- extern cl::opt<bool> EnableAlphaFTOI;
- extern cl::opt<bool> EnableAlphaCT;
extern cl::opt<bool> EnableAlphaCount;
extern cl::opt<bool> EnableAlphaLSMark;
}
@@ -73,7 +71,7 @@
setOperationAction(ISD::UINT_TO_FP, MVT::i64, Expand);
- if (!EnableAlphaCT) {
+ if (!TM.getSubtarget<AlphaSubtarget>().hasCT()) {
setOperationAction(ISD::CTPOP , MVT::i64 , Expand);
setOperationAction(ISD::CTTZ , MVT::i64 , Expand);
setOperationAction(ISD::CTLZ , MVT::i64 , Expand);
Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp
diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.171 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.172
--- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.171 Wed Sep 28 17:29:17 2005
+++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp Thu Sep 29 17:54:56 2005
@@ -13,6 +13,7 @@
#include "Alpha.h"
#include "AlphaRegisterInfo.h"
+#include "AlphaTargetMachine.h"
#include "AlphaISelLowering.h"
#include "llvm/Constants.h" // FIXME: REMOVE
#include "llvm/Function.h"
@@ -38,12 +39,6 @@
cl::opt<bool> EnableAlphaIDIV("enable-alpha-intfpdiv",
cl::desc("Use the FP div instruction for integer div when possible"),
cl::Hidden);
- cl::opt<bool> EnableAlphaFTOI("enable-alpha-FTOI",
- cl::desc("Enable use of ftoi* and itof* instructions (ev6 and higher)"),
- cl::Hidden);
- cl::opt<bool> EnableAlphaCT("enable-alpha-CT",
- cl::desc("Enable use of the ctpop, ctlz, and cttz instructions"),
- cl::Hidden);
cl::opt<bool> EnableAlphaCount("enable-alpha-count",
cl::desc("Print estimates on live ins and outs"),
cl::Hidden);
@@ -428,7 +423,7 @@
void AlphaISel::MoveFP2Int(unsigned src, unsigned dst, bool isDouble)
{
unsigned Opc;
- if (EnableAlphaFTOI) {
+ if (TLI.getTargetMachine().getSubtarget<AlphaSubtarget>().hasF2I()) {
Opc = isDouble ? Alpha::FTOIT : Alpha::FTOIS;
BuildMI(BB, Opc, 1, dst).addReg(src).addReg(Alpha::F31);
} else {
@@ -455,7 +450,7 @@
void AlphaISel::MoveInt2FP(unsigned src, unsigned dst, bool isDouble)
{
unsigned Opc;
- if (EnableAlphaFTOI) {
+ if (TLI.getTargetMachine().getSubtarget<AlphaSubtarget>().hasF2I()) {
Opc = isDouble?Alpha::ITOFT:Alpha::ITOFS;
BuildMI(BB, Opc, 1, dst).addReg(src).addReg(Alpha::R31);
} else {
Index: llvm/lib/Target/Alpha/AlphaTargetMachine.cpp
diff -u llvm/lib/Target/Alpha/AlphaTargetMachine.cpp:1.12 llvm/lib/Target/Alpha/AlphaTargetMachine.cpp:1.13
--- llvm/lib/Target/Alpha/AlphaTargetMachine.cpp:1.12 Thu Sep 1 16:38:20 2005
+++ llvm/lib/Target/Alpha/AlphaTargetMachine.cpp Thu Sep 29 17:54:56 2005
@@ -18,6 +18,7 @@
#include "llvm/Target/TargetOptions.h"
#include "llvm/Target/TargetMachineRegistry.h"
#include "llvm/Transforms/Scalar.h"
+#include "llvm/Support/Debug.h"
#include <iostream>
using namespace llvm;
@@ -62,8 +63,11 @@
const std::string &FS)
: TargetMachine("alpha", IL, true),
FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0),
- JITInfo(*this)
-{}
+ JITInfo(*this),
+ Subtarget(M, FS)
+{
+ DEBUG(std::cerr << "FS is " << FS << "\n");
+}
/// addPassesToEmitFile - Add passes to the specified pass manager to implement
/// a static compiler for this target.
Index: llvm/lib/Target/Alpha/AlphaTargetMachine.h
diff -u llvm/lib/Target/Alpha/AlphaTargetMachine.h:1.9 llvm/lib/Target/Alpha/AlphaTargetMachine.h:1.10
--- llvm/lib/Target/Alpha/AlphaTargetMachine.h:1.9 Thu Sep 1 16:38:20 2005
+++ llvm/lib/Target/Alpha/AlphaTargetMachine.h Thu Sep 29 17:54:56 2005
@@ -19,6 +19,7 @@
#include "llvm/PassManager.h"
#include "AlphaInstrInfo.h"
#include "AlphaJITInfo.h"
+#include "AlphaSubtarget.h"
namespace llvm {
@@ -29,6 +30,7 @@
AlphaInstrInfo InstrInfo;
TargetFrameInfo FrameInfo;
AlphaJITInfo JITInfo;
+ AlphaSubtarget Subtarget;
public:
AlphaTargetMachine(const Module &M, IntrinsicLowering *IL,
@@ -36,6 +38,7 @@
virtual const AlphaInstrInfo *getInstrInfo() const { return &InstrInfo; }
virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
+ virtual const TargetSubtarget *getSubtargetImpl() const{ return &Subtarget; }
virtual const MRegisterInfo *getRegisterInfo() const {
return &InstrInfo.getRegisterInfo();
}
More information about the llvm-commits
mailing list