Go to the documentation of this file.
23 #define DEBUG_TYPE "mips-os16"
26 "mips32-function-mask",
28 cl::desc(
"Force function to be mips32"),
38 StringRef getPassName()
const override {
return "MIPS Os16 Optimization"; }
40 bool runOnModule(
Module &M)
override;
51 Type* RetType =
F.getReturnType();
59 if (
F.arg_size() >=1) {
61 switch (
Arg.getType()->getTypeID()) {
82 case Instruction::FAdd:
83 case Instruction::FSub:
84 case Instruction::FMul:
85 case Instruction::FDiv:
86 case Instruction::FRem:
87 case Instruction::FPToUI:
88 case Instruction::FPToSI:
89 case Instruction::UIToFP:
90 case Instruction::SIToFP:
91 case Instruction::FPTrunc:
92 case Instruction::FPExt:
93 case Instruction::FCmp:
98 if (
const CallInst *CI = dyn_cast<CallInst>(
I)) {
101 Function &F_ = *CI->getCalledFunction();
110 bool MipsOs16::runOnModule(
Module &M) {
112 bool doneUsingMask =
false;
119 unsigned int functionIndex = 0;
120 bool modified =
false;
123 if (
F.isDeclaration())
128 if (!doneUsingMask) {
134 F.addFnAttr(
"nomips16");
137 doneUsingMask =
true;
148 F.addFnAttr(
"nomips16");
152 F.addFnAttr(
"mips16");
This class represents an incoming formal argument to a Function.
@ FloatTyID
32-bit floating point type
@ DoubleTyID
64-bit floating point type
This is an optimization pass for GlobalISel generic memory operations.
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
ModulePass * createMipsOs16Pass()
TypeID getTypeID() const
Return the type id for the type.
The instances of the Type class are immutable: once they are created, they are never changed.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
static cl::opt< std::string > Mips32FunctionMask("mips32-function-mask", cl::init(""), cl::desc("Force function to be mips32"), cl::Hidden)
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
initializer< Ty > init(const Ty &Val)
A Module instance is used to store all the information related to an LLVM module.
StringRef - Represent a constant reference to a string, i.e.
static bool needsFPFromSig(Function &F)
This class represents a function call, abstracting a target machine's calling convention.
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
static bool needsFP(Function &F)
BasicBlockListType::const_iterator const_iterator
InstListType::const_iterator const_iterator