summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2004-11-19 22:14:35 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2004-11-19 22:14:35 +0000
commitce75b2c2cf5b8767572475f2c1c50a336289ad33 (patch)
tree102949dcc5263341c6607ad98f621ee3a2d16b5a
parentdbe04afcb9c7026f4e1fae992268c7a11d24e43a (diff)
downloadbcm5719-llvm-ce75b2c2cf5b8767572475f2c1c50a336289ad33.tar.gz
bcm5719-llvm-ce75b2c2cf5b8767572475f2c1c50a336289ad33.zip
Add protoypes for 64-bit long/ulong div, mul, and rem functions
llvm-svn: 18019
-rw-r--r--llvm/lib/Target/SparcV8/SparcV8ISelSimple.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/lib/Target/SparcV8/SparcV8ISelSimple.cpp b/llvm/lib/Target/SparcV8/SparcV8ISelSimple.cpp
index 8c448fcad38..2786c13f67a 100644
--- a/llvm/lib/Target/SparcV8/SparcV8ISelSimple.cpp
+++ b/llvm/lib/Target/SparcV8/SparcV8ISelSimple.cpp
@@ -36,6 +36,10 @@ namespace {
MachineBasicBlock *BB; // The current MBB we are compiling
int VarArgsOffset; // Offset from fp for start of varargs area
+ // External functions we may use in compiling the Module
+ Function *__div64Fn, *__mul64Fn, *__rem64Fn,
+ *__udiv64Fn, *__umul64Fn, *__urem64Fn;
+
std::map<Value*, unsigned> RegMap; // Mapping between Val's and SSA Regs
// MBBMap - Mapping between LLVM BB -> Machine BB
@@ -43,6 +47,25 @@ namespace {
V8ISel(TargetMachine &tm) : TM(tm), F(0), BB(0) {}
+ bool doInitialization(Module &M) {
+ // Add external functions that we may call
+ Type *l = Type::LongTy;
+ Type *ul = Type::ULongTy;
+ // long __div64(long, long);
+ __div64Fn = M.getOrInsertFunction("__div64", l, l, l, 0);
+ // long __div64(long, long);
+ __mul64Fn = M.getOrInsertFunction("__mul64", l, l, l, 0);
+ // long __div64(long, long);
+ __rem64Fn = M.getOrInsertFunction("__rem64", l, l, l, 0);
+ // unsigned long __udiv64(unsigned long, unsigned long);
+ __udiv64Fn = M.getOrInsertFunction("__udiv64", ul, ul, ul, 0);
+ // unsigned long __umul64(unsigned long, unsigned long);
+ __umul64Fn = M.getOrInsertFunction("__umul64", ul, ul, ul, 0);
+ // unsigned long __urem64(unsigned long, unsigned long);
+ __urem64Fn = M.getOrInsertFunction("__urem64", ul, ul, ul, 0);
+ return true;
+ }
+
/// runOnFunction - Top level implementation of instruction selection for
/// the entire function.
///
OpenPOWER on IntegriCloud