aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/SparcV9/SparcV9InstrSelectionSupport.h
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2002-05-19 15:25:51 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2002-05-19 15:25:51 +0000
commit242a8086aa6ccb29990aaf0c7a591003987330f1 (patch)
tree3d43c025cd8a41780f72c009756961c2a6233b9e /lib/Target/SparcV9/SparcV9InstrSelectionSupport.h
parent78771c886ad18e01859feb4dab8559ab5db464b9 (diff)
downloadexternal_llvm-242a8086aa6ccb29990aaf0c7a591003987330f1.zip
external_llvm-242a8086aa6ccb29990aaf0c7a591003987330f1.tar.gz
external_llvm-242a8086aa6ccb29990aaf0c7a591003987330f1.tar.bz2
Numerous bug fixes:
-- correct sign extensions for integer casts and for shift-by-constant instructions generated for integer multiply -- passing FP arguments to functions with more than 6 arguments -- passing FP arguments to varargs functions -- passing FP arguments to functions with no prototypes -- incorrect stack frame size when padding a section -- folding getelementptr operations with mixed array and struct indexes -- use uint64_t instead of uint for constant offsets in mem operands -- incorrect coloring for CC registers (both int and FP): interferences were being completely ignored for int CC and were considered but no spills were marked for fp CC! Also some code improvements: -- better interface to generating machine instr for common cases (many places still need to be updated to use this interface) -- annotations on MachineInstr to communicate information from one codegen phase to another (now used to pass information about CALL/JMPLCALL operands from selection to register allocation) -- all sizes and offests in class TargetData are uint64_t instead of uint git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2640 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/SparcV9/SparcV9InstrSelectionSupport.h')
-rw-r--r--lib/Target/SparcV9/SparcV9InstrSelectionSupport.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/Target/SparcV9/SparcV9InstrSelectionSupport.h b/lib/Target/SparcV9/SparcV9InstrSelectionSupport.h
index 848dddd..2ee9294 100644
--- a/lib/Target/SparcV9/SparcV9InstrSelectionSupport.h
+++ b/lib/Target/SparcV9/SparcV9InstrSelectionSupport.h
@@ -12,6 +12,8 @@
#ifndef SPARC_INSTR_SELECTION_SUPPORT_h
#define SPARC_INSTR_SELECTION_SUPPORT_h
+#include "llvm/DerivedTypes.h"
+#include "llvm/Value.h"
inline MachineOpCode
ChooseLoadInstruction(const Type *DestTy)
@@ -58,4 +60,29 @@ ChooseStoreInstruction(const Type *DestTy)
return 0;
}
+
+inline MachineOpCode
+ChooseAddInstructionByType(const Type* resultType)
+{
+ MachineOpCode opCode = INVALID_OPCODE;
+
+ if (resultType->isIntegral() ||
+ isa<PointerType>(resultType) ||
+ isa<FunctionType>(resultType) ||
+ resultType == Type::LabelTy ||
+ resultType == Type::BoolTy)
+ {
+ opCode = ADD;
+ }
+ else
+ switch(resultType->getPrimitiveID())
+ {
+ case Type::FloatTyID: opCode = FADDS; break;
+ case Type::DoubleTyID: opCode = FADDD; break;
+ default: assert(0 && "Invalid type for ADD instruction"); break;
+ }
+
+ return opCode;
+}
+
#endif