23#define DEBUG_TYPE "mips-os16"
26 "mips32-function-mask",
28 cl::desc(
"Force function to be mips32"),
43 char MipsOs16::ID = 0;
51 Type* RetType =
F.getReturnType();
59 if (
F.arg_size() >=1) {
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();
110bool 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");
Module.h This file contains the declarations for the Module class.
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)
This class represents an incoming formal argument to a Function.
InstListType::const_iterator const_iterator
This class represents a function call, abstracting a target machine's calling convention.
BasicBlockListType::const_iterator const_iterator
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
virtual bool runOnModule(Module &M)=0
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
A Module instance is used to store all the information related to an LLVM module.
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
StringRef - Represent a constant reference to a string, i.e.
The instances of the Type class are immutable: once they are created, they are never changed.
@ FloatTyID
32-bit floating point type
@ DoubleTyID
64-bit floating point type
TypeID getTypeID() const
Return the type id for the type.
Type * getType() const
All values are typed, get the type of this value.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
ModulePass * createMipsOs16Pass()