2017-10-20 05:37:38 +08:00
|
|
|
//===-- RISCV.h - Top-level interface for RISCV -----------------*- 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
|
|
|
|
// RISC-V back-end.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_LIB_TARGET_RISCV_RISCV_H
|
|
|
|
#define LLVM_LIB_TARGET_RISCV_RISCV_H
|
|
|
|
|
2017-11-08 21:24:21 +08:00
|
|
|
#include "MCTargetDesc/RISCVBaseInfo.h"
|
2017-10-20 05:37:38 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
class RISCVTargetMachine;
|
2017-11-08 21:24:21 +08:00
|
|
|
class AsmPrinter;
|
|
|
|
class FunctionPass;
|
2017-10-20 05:37:38 +08:00
|
|
|
class MCInst;
|
2017-11-08 21:24:21 +08:00
|
|
|
class MCOperand;
|
2017-10-20 05:37:38 +08:00
|
|
|
class MachineInstr;
|
2017-11-08 21:24:21 +08:00
|
|
|
class MachineOperand;
|
[RISCV] Add machine function pass to merge base + offset
Summary:
In r333455 we added a peephole to fix the corner cases that result
from separating base + offset lowering of global address.The
peephole didn't handle some of the cases because it only has a basic
block view instead of a function level view.
This patch replaces that logic with a machine function pass. In
addition to handling the original cases it handles uses of the global
address across blocks in function and folding an offset from LW\SW
instruction. This pass won't run for OptNone compilation, so there
will be a negative impact overall vs the old approach at O0.
Reviewers: asb, apazos, mgrang
Reviewed By: asb
Subscribers: MartinMosbeck, brucehoult, the_o, rogfer01, mgorny, rbar, johnrusso, simoncook, niosHD, kito-cheng, shiva0217, zzheng, llvm-commits, edward-jones
Differential Revision: https://reviews.llvm.org/D47857
llvm-svn: 335786
2018-06-28 04:51:42 +08:00
|
|
|
class PassRegistry;
|
2017-10-20 05:37:38 +08:00
|
|
|
|
2017-11-08 21:24:21 +08:00
|
|
|
void LowerRISCVMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI,
|
|
|
|
const AsmPrinter &AP);
|
|
|
|
bool LowerRISCVMachineOperandToMCOperand(const MachineOperand &MO,
|
|
|
|
MCOperand &MCOp, const AsmPrinter &AP);
|
2017-10-20 05:37:38 +08:00
|
|
|
|
|
|
|
FunctionPass *createRISCVISelDag(RISCVTargetMachine &TM);
|
[RISCV] Add machine function pass to merge base + offset
Summary:
In r333455 we added a peephole to fix the corner cases that result
from separating base + offset lowering of global address.The
peephole didn't handle some of the cases because it only has a basic
block view instead of a function level view.
This patch replaces that logic with a machine function pass. In
addition to handling the original cases it handles uses of the global
address across blocks in function and folding an offset from LW\SW
instruction. This pass won't run for OptNone compilation, so there
will be a negative impact overall vs the old approach at O0.
Reviewers: asb, apazos, mgrang
Reviewed By: asb
Subscribers: MartinMosbeck, brucehoult, the_o, rogfer01, mgorny, rbar, johnrusso, simoncook, niosHD, kito-cheng, shiva0217, zzheng, llvm-commits, edward-jones
Differential Revision: https://reviews.llvm.org/D47857
llvm-svn: 335786
2018-06-28 04:51:42 +08:00
|
|
|
|
|
|
|
FunctionPass *createRISCVMergeBaseOffsetOptPass();
|
|
|
|
void initializeRISCVMergeBaseOffsetOptPass(PassRegistry &);
|
2017-10-20 05:37:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|