23#define DEBUG_TYPE "mips-os16"
32 StringRef getPassName()
const override {
return "MIPS Os16 Optimization"; }
34 bool runOnModule(
Module &M)
override;
37 char MipsOs16::ID = 0;
45 Type* RetType =
F.getReturnType();
53 if (
F.arg_size() >=1) {
76 case Instruction::FAdd:
77 case Instruction::FSub:
78 case Instruction::FMul:
79 case Instruction::FDiv:
80 case Instruction::FRem:
81 case Instruction::FPToUI:
82 case Instruction::FPToSI:
83 case Instruction::UIToFP:
84 case Instruction::SIToFP:
85 case Instruction::FPTrunc:
86 case Instruction::FPExt:
87 case Instruction::FCmp:
95 Function &F_ = *CI->getCalledFunction();
104bool MipsOs16::runOnModule(
Module &M) {
105 StringRef Mips32FunctionMask = MipsOptions::Global.mips32_function_mask;
106 bool usingMask = !Mips32FunctionMask.
empty();
107 bool doneUsingMask =
false;
110 << Mips32FunctionMask <<
"\n");
112 LLVM_DEBUG(
dbgs() <<
"using mask \n" << Mips32FunctionMask <<
"\n");
114 unsigned int functionIndex = 0;
115 bool modified =
false;
118 if (
F.isDeclaration())
123 if (!doneUsingMask) {
124 if (functionIndex == Mips32FunctionMask.
size())
126 switch (Mips32FunctionMask[functionIndex]) {
129 F.addFnAttr(
"nomips16");
132 doneUsingMask =
true;
143 F.addFnAttr(
"nomips16");
147 F.addFnAttr(
"mips16");
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Module.h This file contains the declarations for the Module class.
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...
A Module instance is used to store all the information related to an LLVM module.
Represent a constant reference to a string, i.e.
constexpr bool empty() const
Check if the string is empty.
constexpr size_t size() const
Get the string size.
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.
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
ModulePass * createMipsOs16Pass()