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;
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)) {
99 DEBUG(
dbgs() <<
"Working on call" <<
"\n");
100 Function &F_ = *CI->getCalledFunction();
109 bool MipsOs16::runOnModule(
Module &M) {
111 bool doneUsingMask =
false;
117 unsigned int functionIndex = 0;
118 bool modified =
false;
121 if (
F.isDeclaration())
124 DEBUG(
dbgs() <<
"Working on " <<
F.getName() <<
"\n");
126 if (!doneUsingMask) {
131 DEBUG(
dbgs() <<
"mask forced mips32: " <<
F.getName() <<
"\n");
132 F.addFnAttr(
"nomips16");
135 doneUsingMask =
true;
145 DEBUG(
dbgs() <<
"os16 forced mips32: " <<
F.getName() <<
"\n");
146 F.addFnAttr(
"nomips16");
149 DEBUG(
dbgs() <<
"os16 forced mips16: " <<
F.getName() <<
"\n");
150 F.addFnAttr(
"mips16");
LLVM Argument representation.
A Module instance is used to store all the information related to an LLVM module. ...
2: 32-bit floating point type
This class represents a function call, abstracting a target machine's calling convention.
Type * getReturnType() const
Returns the type of the ret val.
static cl::opt< std::string > Mips32FunctionMask("mips32-function-mask", cl::init(""), cl::desc("Force function to be mips32"), cl::Hidden)
static bool needsFPFromSig(Function &F)
static bool needsFP(Function &F)
TypeID getTypeID() const
Return the type id for the type.
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
initializer< Ty > init(const Ty &Val)
The instances of the Type class are immutable: once they are created, they are never changed...
Iterator for intrusive lists based on ilist_node.
Module.h This file contains the declarations for the Module class.
Type * getType() const
All values are typed, get the type of this value.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
ModulePass * createMipsOs16Pass(MipsTargetMachine &TM)
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
3: 64-bit floating point type
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
const ArgumentListType & getArgumentList() const
Get the underlying elements of the Function...
StringRef - Represent a constant reference to a string, i.e.