mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
68e5128508
Mips32 code as Mips16 unless it can't be compiled as Mips 16. For now this would happen as long as floating point instructions are not needed. Probably it would also make sense to compile as mips32 if atomic operations are needed too. There may be other cases too. A module pass prescans the IR and adds the mips16 or nomips16 attribute to functions depending on the functions needs. Mips 16 mode can result in a 40% code compression by utililizing 16 bit encoding of many instructions. The hope is for this to replace the traditional gcc way of dealing with Mips16 code using floating point which involves essentially using soft float but with a library implemented using mips32 floating point. This gcc method also requires creating stubs so that Mips32 code can interact with these Mips 16 functions that have floating point needs. My conjecture is that in reality this traditional gcc method would never win over this new method. I will be implementing the traditional gcc method also. Some of it is already done but I needed to do the stubs to finish the work and those required this mips16/32 mixed mode capability. I have more ideas for to make this new method much better and I think the old method will just live in llvm for anyone that needs the backward compatibility but I don't for what reason that would be needed. llvm-svn: 179185
50 lines
1007 B
C++
50 lines
1007 B
C++
//===---- MipsOs16.h for Mips Option -Os16 --------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file defines an optimization phase for the MIPS target.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "MCTargetDesc/MipsMCTargetDesc.h"
|
|
#include "MipsTargetMachine.h"
|
|
#include "llvm/Pass.h"
|
|
#include "llvm/Target/TargetMachine.h"
|
|
|
|
|
|
|
|
#ifndef MIPSOS16_H
|
|
#define MIPSOS16_H
|
|
|
|
using namespace llvm;
|
|
|
|
namespace llvm {
|
|
|
|
class MipsOs16 : public ModulePass {
|
|
|
|
public:
|
|
static char ID;
|
|
|
|
MipsOs16() : ModulePass(ID) {
|
|
|
|
}
|
|
|
|
virtual const char *getPassName() const {
|
|
return "MIPS Os16 Optimization";
|
|
}
|
|
|
|
virtual bool runOnModule(Module &M);
|
|
|
|
};
|
|
|
|
ModulePass *createMipsOs16(MipsTargetMachine &TM);
|
|
|
|
}
|
|
|
|
#endif
|