forked from Hoernchen/Epiphany
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Hoernchen
committed
May 3, 2013
1 parent
9343877
commit 3346ce7
Showing
59 changed files
with
7,076 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
set(LLVM_TARGET_DEFINITIONS Epiphany.td) | ||
|
||
#tablegen(LLVM EpiphanyGenAsmMatcher.inc -gen-asm-matcher) | ||
tablegen(LLVM EpiphanyGenAsmWriter.inc -gen-asm-writer) | ||
tablegen(LLVM EpiphanyGenCallingConv.inc -gen-callingconv) | ||
#tablegen(LLVM EpiphanyGenDisassemblerTables.inc -gen-disassembler) | ||
tablegen(LLVM EpiphanyGenInstrInfo.inc -gen-instr-info) | ||
#tablegen(LLVM EpiphanyGenMCCodeEmitter.inc -gen-emitter -mc-emitter) | ||
tablegen(LLVM EpiphanyGenMCPseudoLowering.inc -gen-pseudo-lowering) | ||
tablegen(LLVM EpiphanyGenRegisterInfo.inc -gen-register-info) | ||
tablegen(LLVM EpiphanyGenDAGISel.inc -gen-dag-isel) | ||
tablegen(LLVM EpiphanyGenSubtargetInfo.inc -gen-subtarget) | ||
add_public_tablegen_target(EpiphanyCommonTableGen) | ||
|
||
add_llvm_target(EpiphanyCodeGen | ||
EpiphanyAsmPrinter.cpp | ||
EpiphanyFrameLowering.cpp | ||
EpiphanyISelDAGToDAG.cpp | ||
EpiphanyISelLowering.cpp | ||
EpiphanyInstrInfo.cpp | ||
EpiphanyMachineFunctionInfo.cpp | ||
EpiphanyMCInstLower.cpp | ||
EpiphanyRegisterInfo.cpp | ||
EpiphanySelectionDAGInfo.cpp | ||
EpiphanySubtarget.cpp | ||
EpiphanyTargetMachine.cpp | ||
EpiphanyTargetObjectFile.cpp | ||
EpiphanyLSOptPass.cpp | ||
CondMovPass.cpp | ||
) | ||
|
||
#add_subdirectory(AsmParser) | ||
#add_subdirectory(Disassembler) | ||
add_subdirectory(InstPrinter) | ||
add_subdirectory(MCTargetDesc) | ||
add_subdirectory(TargetInfo) | ||
add_subdirectory(Utils) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
//===-- EpiphanyCondMovPass.cpp -----------------------===// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is distributed under the University of Illinois Open Source | ||
// License. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#define DEBUG_TYPE "epiphany_condmovpass" | ||
#include "Epiphany.h" | ||
#include "EpiphanyMachineFunctionInfo.h" | ||
#include "EpiphanySubtarget.h" | ||
#include "EpiphanyTargetMachine.h" | ||
#include "llvm/CodeGen/MachineDominators.h" | ||
#include "llvm/CodeGen/MachineFunctionPass.h" | ||
#include "llvm/CodeGen/MachineInstrBuilder.h" | ||
#include "llvm/CodeGen/MachineLoopInfo.h" | ||
#include "llvm/CodeGen/MachineRegisterInfo.h" | ||
#include "llvm/CodeGen/Passes.h" | ||
#include "llvm/Support/Compiler.h" | ||
#include "llvm/Support/Debug.h" | ||
#include "llvm/Support/MathExtras.h" | ||
#include "llvm/Target/TargetInstrInfo.h" | ||
#include "llvm/Target/TargetMachine.h" | ||
#include "llvm/Target/TargetRegisterInfo.h" | ||
|
||
using namespace llvm; | ||
|
||
namespace { | ||
|
||
class EpiphanyCondMovPass : public MachineFunctionPass { | ||
|
||
private: | ||
EpiphanyTargetMachine& QTM; | ||
|
||
public: | ||
static char ID; | ||
EpiphanyCondMovPass(EpiphanyTargetMachine& TM) : MachineFunctionPass(ID), QTM(TM) {} | ||
|
||
const char *getPassName() const { | ||
return "Epiphany movCC cleanup"; | ||
} | ||
bool runOnMachineFunction(MachineFunction &Fn); | ||
}; | ||
|
||
char EpiphanyCondMovPass::ID = 0; | ||
|
||
bool EpiphanyCondMovPass::runOnMachineFunction(MachineFunction &Fn) { | ||
bool modified = false; | ||
// Loop over all of the basic blocks. | ||
for(MachineFunction::iterator MBBb = Fn.begin(), MBBe = Fn.end(); MBBb != MBBe; ++MBBb) { | ||
MachineBasicBlock* MBB = MBBb; | ||
|
||
std::vector<MachineInstr*> killmeplease; | ||
// Loop over all instructions. | ||
for(MachineBasicBlock::iterator MII = MBB->begin(), E = MBB->end(); MII != E; ++MII){ | ||
MachineInstr *MI = &*MII; | ||
if((MI->getOpcode() == Epiphany::MOVww || MI->getOpcode() == Epiphany::MOVss) && MI->getOperand(0).isReg() && MI->getOperand(1).isReg() && MI->getOperand(0).getReg() == MI->getOperand(1).getReg()) | ||
killmeplease.push_back(MI); | ||
} | ||
|
||
if(!killmeplease.empty()){ | ||
modified = true; | ||
for (std::vector<MachineInstr*>::iterator kb = killmeplease.begin(), ke = killmeplease.end(); kb != ke ; kb++) | ||
(*kb)->eraseFromParent(); // we can safely do this because mov Rd, Rd is a nop with no side effects. | ||
} | ||
|
||
} | ||
return modified; | ||
} | ||
|
||
}// namespace | ||
|
||
|
||
//===----------------------------------------------------------------------===// | ||
// Public Constructor Functions | ||
//===----------------------------------------------------------------------===// | ||
|
||
FunctionPass *llvm::createEpiphanyCondMovPass(EpiphanyTargetMachine &TM) { | ||
return new EpiphanyCondMovPass(TM); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
//==-- Epiphany.h - Top-level interface for Epiphany representation -*- C++ -*-=// | ||
// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is distributed under the University of Illinois Open Source | ||
// License. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This file contains the entry points for global functions defined in the LLVM | ||
// Epiphany back-end. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLVM_TARGET_EPIPHANY_H | ||
#define LLVM_TARGET_EPIPHANY_H | ||
|
||
#include "MCTargetDesc/EpiphanyMCTargetDesc.h" | ||
#include "llvm/Target/TargetMachine.h" | ||
|
||
namespace llvm { | ||
|
||
class EpiphanyAsmPrinter; | ||
class FunctionPass; | ||
class EpiphanyTargetMachine; | ||
class MachineInstr; | ||
class MCInst; | ||
|
||
FunctionPass *createEpiphanyISelDAG(EpiphanyTargetMachine &TM, | ||
CodeGenOpt::Level OptLevel); | ||
|
||
FunctionPass *createEpiphanyCondMovPass(EpiphanyTargetMachine &TM); | ||
|
||
FunctionPass *createEpiphanyLSOptPass(); | ||
|
||
void LowerEpiphanyMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI, | ||
EpiphanyAsmPrinter &AP); | ||
|
||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
//===- Epiphany.td - Describe the Epiphany Target Machine -------*- tblgen -*-==// | ||
// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is distributed under the University of Illinois Open Source | ||
// License. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This is the top level entry point for the Epiphany target. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
//===----------------------------------------------------------------------===// | ||
// Target-independent interfaces | ||
//===----------------------------------------------------------------------===// | ||
|
||
include "llvm/Target/Target.td" | ||
|
||
//===----------------------------------------------------------------------===// | ||
// Epiphany Processors | ||
// | ||
|
||
include "EpiphanySchedule.td" | ||
|
||
def : Processor<"generic", GenericItineraries, []>; | ||
|
||
//===----------------------------------------------------------------------===// | ||
// Register File Description | ||
//===----------------------------------------------------------------------===// | ||
|
||
include "EpiphanyRegisterInfo.td" | ||
|
||
include "EpiphanyCallingConv.td" | ||
|
||
//===----------------------------------------------------------------------===// | ||
// Instruction Descriptions | ||
//===----------------------------------------------------------------------===// | ||
|
||
include "EpiphanyInstrInfo.td" | ||
|
||
def EpiphanyInstrInfo : InstrInfo; | ||
|
||
//===----------------------------------------------------------------------===// | ||
// Assembly printer | ||
//===----------------------------------------------------------------------===// | ||
|
||
def A64InstPrinter : AsmWriter { | ||
string AsmWriterClassName = "InstPrinter"; | ||
bit isMCAsmWriter = 1; | ||
} | ||
|
||
//===----------------------------------------------------------------------===// | ||
// Declare the target which we are implementing | ||
//===----------------------------------------------------------------------===// | ||
|
||
def Epiphany : Target { | ||
let InstructionSet = EpiphanyInstrInfo; | ||
let AssemblyWriters = [A64InstPrinter]; | ||
} |
Oops, something went wrong.