LLVM: lib/Target/Hexagon/HexagonSplitConst32AndConst64.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
28
29using namespace llvm;
30
31#define DEBUG_TYPE "xfer"
32
33namespace {
35 public:
36 static char ID;
38 StringRef getPassName() const override {
39 return "Hexagon Split Const32s and Const64s";
40 }
44 }
45 };
46}
47
48char HexagonSplitConst32AndConst64::ID = 0;
49
50INITIALIZE_PASS(HexagonSplitConst32AndConst64, "split-const-for-sdata",
51 "Hexagon Split Const32s and Const64s", false, false)
52
53bool HexagonSplitConst32AndConst64::runOnMachineFunction(MachineFunction &Fn) {
57 if (HST.useSmallData() && TLOF.isSmallDataEnabled(HTM))
58 return false;
59
62
63
66 unsigned Opc = MI.getOpcode();
67
68 if (Opc == Hexagon::CONST32) {
69 Register DestReg = MI.getOperand(0).getReg();
70 uint64_t ImmValue = MI.getOperand(1).getImm();
75 } else if (Opc == Hexagon::CONST64) {
76 Register DestReg = MI.getOperand(0).getReg();
77 int64_t ImmValue = MI.getOperand(1).getImm();
79 Register DestLo = TRI->getSubReg(DestReg, Hexagon::isub_lo);
80 Register DestHi = TRI->getSubReg(DestReg, Hexagon::isub_hi);
81
82 int32_t LowWord = (ImmValue & 0xFFFFFFFF);
83 int32_t HighWord = (ImmValue >> 32) & 0xFFFFFFFF;
84
90 }
91 }
92 }
93
94 return true;
95}
96
97
98
99
100
102 return new HexagonSplitConst32AndConst64();
103}
for(const MachineOperand &MO :llvm::drop_begin(OldMI.operands(), Desc.getNumOperands()))
const TargetInstrInfo & TII
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
Register const TargetRegisterInfo * TRI
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
FunctionPass class - This class is used to implement most global optimizations.
HexagonTargetObjectFile * getObjFileLowering() const override
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
Properties which a MachineFunction may have at a given point in time.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
Representation of each machine instruction.
Wrapper class representing virtual and physical registers.
StringRef - Represent a constant reference to a string, i.e.
TargetInstrInfo - Interface to description of machine instruction set.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
FunctionPass * createHexagonSplitConst32AndConst64()
Definition HexagonSplitConst32AndConst64.cpp:101