You've already forked linux-packaging-mono
acceptance-tests
data
docs
external
Newtonsoft.Json
api-doc-tools
api-snapshot
aspnetwebstack
bdwgc
binary-reference-assemblies
bockbuild
boringssl
cecil
cecil-legacy
corefx
corert
helix-binaries
ikdasm
ikvm
illinker-test-assets
linker
llvm-project
clang
clang-tools-extra
compiler-rt
eng
libcxx
libcxxabi
libunwind
lld
lldb
llvm
bindings
cmake
docs
examples
include
lib
Analysis
AsmParser
BinaryFormat
Bitcode
CodeGen
DebugInfo
Demangle
ExecutionEngine
FuzzMutate
Fuzzer
IR
IRReader
LTO
LineEditor
Linker
MC
Object
ObjectYAML
Option
Passes
ProfileData
Support
TableGen
Target
AArch64
AMDGPU
ARC
Disassembler
InstPrinter
MCTargetDesc
TargetInfo
ARC.h
ARC.td
ARCAsmPrinter.cpp
ARCBranchFinalize.cpp
ARCCallingConv.td
ARCExpandPseudos.cpp
ARCFrameLowering.cpp
ARCFrameLowering.h
ARCISelDAGToDAG.cpp
ARCISelLowering.cpp
ARCISelLowering.h
ARCInstrFormats.td
ARCInstrInfo.cpp
ARCInstrInfo.h
ARCInstrInfo.td
ARCMCInstLower.cpp
ARCMCInstLower.h
ARCMachineFunctionInfo.cpp
ARCMachineFunctionInfo.h
ARCRegisterInfo.cpp
ARCRegisterInfo.h
ARCRegisterInfo.td
ARCSubtarget.cpp
ARCSubtarget.h
ARCTargetMachine.cpp
ARCTargetMachine.h
ARCTargetStreamer.h
ARCTargetTransformInfo.h
CMakeLists.txt
LLVMBuild.txt
ARM
AVR
BPF
Hexagon
Lanai
MSP430
Mips
NVPTX
Nios2
PowerPC
RISCV
Sparc
SystemZ
WebAssembly
X86
XCore
CMakeLists.txt
LLVMBuild.txt
README.txt
Target.cpp
TargetIntrinsicInfo.cpp
TargetLoweringObjectFile.cpp
TargetMachine.cpp
TargetMachineC.cpp
Testing
ToolDrivers
Transforms
WindowsManifest
XRay
CMakeLists.txt
LLVMBuild.txt
projects
resources
runtimes
scripts
test
tools
unittests
utils
.arcconfig
.clang-format
.clang-tidy
.gitattributes
.gitignore
CMakeLists.txt
CODE_OWNERS.TXT
CREDITS.TXT
LICENSE.TXT
LLVMBuild.txt
README.txt
RELEASE_TESTERS.TXT
configure
llvm.spec.in
version.txt.in
nuget
openmp
polly
Directory.Build.props
Directory.Build.targets
NuGet.config
azure-pipelines.yml
build.cmd
build.sh
dir.common.props
global.json
llvm.proj
mxe-Win64.cmake.in
nuget-buildtasks
nunit-lite
roslyn-binaries
rx
xunit-binaries
how-to-bump-roslyn-binaries.md
ikvm-native
llvm
m4
man
mcs
mono
msvc
netcore
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h
104 lines
2.9 KiB
C++
104 lines
2.9 KiB
C++
![]() |
//===- ARCExpandPseudosPass - ARC expand pseudo loads -----------*- C++ -*-===//
|
||
|
//
|
||
|
// The LLVM Compiler Infrastructure
|
||
|
//
|
||
|
// This file is distributed under the University of Illinois Open Source
|
||
|
// License. See LICENSE.TXT for details.
|
||
|
//
|
||
|
//===----------------------------------------------------------------------===//
|
||
|
//
|
||
|
// This pass expands stores with large offsets into an appropriate sequence.
|
||
|
//===----------------------------------------------------------------------===//
|
||
|
|
||
|
#include "ARC.h"
|
||
|
#include "ARCInstrInfo.h"
|
||
|
#include "ARCRegisterInfo.h"
|
||
|
#include "ARCSubtarget.h"
|
||
|
#include "llvm/ADT/Statistic.h"
|
||
|
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||
|
#include "llvm/CodeGen/MachineInstrBuilder.h"
|
||
|
#include "llvm/CodeGen/MachineRegisterInfo.h"
|
||
|
|
||
|
using namespace llvm;
|
||
|
|
||
|
#define DEBUG_TYPE "arc-expand-pseudos"
|
||
|
|
||
|
namespace {
|
||
|
|
||
|
class ARCExpandPseudos : public MachineFunctionPass {
|
||
|
public:
|
||
|
static char ID;
|
||
|
ARCExpandPseudos() : MachineFunctionPass(ID) {}
|
||
|
|
||
|
bool runOnMachineFunction(MachineFunction &Fn) override;
|
||
|
|
||
|
StringRef getPassName() const override { return "ARC Expand Pseudos"; }
|
||
|
|
||
|
private:
|
||
|
void ExpandStore(MachineFunction &, MachineBasicBlock::iterator);
|
||
|
|
||
|
const ARCInstrInfo *TII;
|
||
|
};
|
||
|
|
||
|
char ARCExpandPseudos::ID = 0;
|
||
|
|
||
|
} // end anonymous namespace
|
||
|
|
||
|
static unsigned getMappedOp(unsigned PseudoOp) {
|
||
|
switch (PseudoOp) {
|
||
|
case ARC::ST_FAR:
|
||
|
return ARC::ST_rs9;
|
||
|
case ARC::STH_FAR:
|
||
|
return ARC::STH_rs9;
|
||
|
case ARC::STB_FAR:
|
||
|
return ARC::STB_rs9;
|
||
|
default:
|
||
|
llvm_unreachable("Unhandled pseudo op.");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void ARCExpandPseudos::ExpandStore(MachineFunction &MF,
|
||
|
MachineBasicBlock::iterator SII) {
|
||
|
MachineInstr &SI = *SII;
|
||
|
unsigned AddrReg = MF.getRegInfo().createVirtualRegister(&ARC::GPR32RegClass);
|
||
|
unsigned AddOpc =
|
||
|
isUInt<6>(SI.getOperand(2).getImm()) ? ARC::ADD_rru6 : ARC::ADD_rrlimm;
|
||
|
BuildMI(*SI.getParent(), SI, SI.getDebugLoc(), TII->get(AddOpc), AddrReg)
|
||
|
.addReg(SI.getOperand(1).getReg())
|
||
|
.addImm(SI.getOperand(2).getImm());
|
||
|
BuildMI(*SI.getParent(), SI, SI.getDebugLoc(),
|
||
|
TII->get(getMappedOp(SI.getOpcode())))
|
||
|
.addReg(SI.getOperand(0).getReg())
|
||
|
.addReg(AddrReg)
|
||
|
.addImm(0);
|
||
|
SI.eraseFromParent();
|
||
|
}
|
||
|
|
||
|
bool ARCExpandPseudos::runOnMachineFunction(MachineFunction &MF) {
|
||
|
const ARCSubtarget *STI = &MF.getSubtarget<ARCSubtarget>();
|
||
|
TII = STI->getInstrInfo();
|
||
|
bool ExpandedStore = false;
|
||
|
for (auto &MBB : MF) {
|
||
|
MachineBasicBlock::iterator MBBI = MBB.begin(), E = MBB.end();
|
||
|
while (MBBI != E) {
|
||
|
MachineBasicBlock::iterator NMBBI = std::next(MBBI);
|
||
|
switch (MBBI->getOpcode()) {
|
||
|
case ARC::ST_FAR:
|
||
|
case ARC::STH_FAR:
|
||
|
case ARC::STB_FAR:
|
||
|
ExpandStore(MF, MBBI);
|
||
|
ExpandedStore = true;
|
||
|
break;
|
||
|
default:
|
||
|
break;
|
||
|
}
|
||
|
MBBI = NMBBI;
|
||
|
}
|
||
|
}
|
||
|
return ExpandedStore;
|
||
|
}
|
||
|
|
||
|
FunctionPass *llvm::createARCExpandPseudosPass() {
|
||
|
return new ARCExpandPseudos();
|
||
|
}
|