25#define DEBUG_TYPE "mips-os16"
34 StringRef getPassName()
const override {
return "MIPS Os16 Optimization"; }
36 bool runOnModule(
Module &M)
override;
44char MipsOs16Legacy::ID = 0;
52 Type* RetType =
F.getReturnType();
60 if (
F.arg_size() >=1) {
83 case Instruction::FAdd:
84 case Instruction::FSub:
85 case Instruction::FMul:
86 case Instruction::FDiv:
87 case Instruction::FRem:
88 case Instruction::FPToUI:
89 case Instruction::FPToSI:
90 case Instruction::UIToFP:
91 case Instruction::SIToFP:
92 case Instruction::FPTrunc:
93 case Instruction::FPExt:
94 case Instruction::FCmp:
102 Function &F_ = *CI->getCalledFunction();
111 const MipsOptions &Opts =
112 M.getContext().getLibraryOptions().get<MipsOptions>();
113 StringRef Mips32FunctionMask = Opts.mips32_function_mask;
114 bool usingMask = !Mips32FunctionMask.
empty();
115 bool doneUsingMask =
false;
118 << Mips32FunctionMask <<
"\n");
120 LLVM_DEBUG(
dbgs() <<
"using mask \n" << Mips32FunctionMask <<
"\n");
122 unsigned int functionIndex = 0;
123 bool modified =
false;
126 if (
F.isDeclaration())
131 if (!doneUsingMask) {
132 if (functionIndex == Mips32FunctionMask.size())
134 switch (Mips32FunctionMask[functionIndex]) {
137 F.addFnAttr(
"nomips16");
140 doneUsingMask =
true;
151 F.addFnAttr(
"nomips16");
155 F.addFnAttr(
"mips16");
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Module.h This file contains the declarations for the Module class.
This header defines various interfaces for pass management in LLVM.
static bool needsFPFromSig(Function &F)
static bool needsFP(Function &F)
static bool runOs16OnModule(Module &M)
ModuleAnalysisManager MAM
Represent the analysis usage information of a pass.
LLVM_ABI void setPreservesCFG()
This function should be called by the pass, iff they do not:
This class represents an incoming formal argument to a Function.
InstListType::const_iterator const_iterator
Represents analyses that only rely on functions' control flow.
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.
PreservedAnalyses run(Module &M, ModuleAnalysisManager &MAM)
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.
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
PreservedAnalyses & preserveSet()
Mark an analysis set as preserved.
Represent a constant reference to a string, i.e.
constexpr bool empty() const
Check if the string is empty.
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.
Pass manager infrastructure for declaring and invalidating analyses.
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.
ModulePass * createMipsOs16LegacyPass()
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
AnalysisManager< Module > ModuleAnalysisManager
Convenience typedef for the Module analysis manager.