23 #define DEBUG_TYPE "mips-os16"
26 "mips32-function-mask",
28 cl::desc(
"Force function to be mips32"),
38 const char *getPassName()
const override {
39 return "MIPS Os16 Optimization";
42 bool runOnModule(
Module &M)
override;
84 case Instruction::FAdd:
85 case Instruction::FSub:
86 case Instruction::FMul:
87 case Instruction::FDiv:
88 case Instruction::FRem:
89 case Instruction::FPToUI:
90 case Instruction::FPToSI:
91 case Instruction::UIToFP:
92 case Instruction::SIToFP:
93 case Instruction::FPTrunc:
94 case Instruction::FPExt:
95 case Instruction::FCmp:
100 if (
const CallInst *CI = dyn_cast<CallInst>(
I)) {
101 DEBUG(
dbgs() <<
"Working on call" <<
"\n");
102 Function &F_ = *CI->getCalledFunction();
111 bool MipsOs16::runOnModule(
Module &M) {
113 bool doneUsingMask =
false;
117 unsigned int functionIndex = 0;
118 bool modified =
false;
120 if (
F->isDeclaration())
continue;
121 DEBUG(
dbgs() <<
"Working on " <<
F->getName() <<
"\n");
123 if (!doneUsingMask) {
128 DEBUG(
dbgs() <<
"mask forced mips32: " <<
F->getName() <<
"\n");
129 F->addFnAttr(
"nomips16");
132 doneUsingMask =
true;
142 DEBUG(
dbgs() <<
"os16 forced mips32: " <<
F->getName() <<
"\n");
143 F->addFnAttr(
"nomips16");
146 DEBUG(
dbgs() <<
"os16 forced mips16: " <<
F->getName() <<
"\n");
147 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
CallInst - This class represents a function call, abstracting a target machine's calling convention...
Type * getReturnType() const
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
getTypeID - Return the type id for the type.
initializer< Ty > init(const Ty &Val)
The instances of the Type class are immutable: once they are created, they are never changed...
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
getOpcode() returns a member of one of the enums like Instruction::Add.
const ArgumentListType & getArgumentList() const
Get the underlying elements of the Function...