Skip to content

Commit

Permalink
Mico32 -> LM32
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastien Bourdeauducq committed May 31, 2012
1 parent ddbd2d4 commit cf78366
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 28 deletions.
26 changes: 12 additions & 14 deletions lib/Basic/Targets.cpp
Expand Up @@ -1135,14 +1135,14 @@ void MBlazeTargetInfo::getGCCRegAliases(const GCCRegAlias *&Aliases,
} // end anonymous namespace.

namespace {
// Mico32 abstract base class
class Mico32TargetInfo : public TargetInfo {
// LM32 abstract base class
class LM32TargetInfo : public TargetInfo {
static const char * const GCCRegNames[];
static const TargetInfo::GCCRegAlias GCCRegAliases[];
std::vector<llvm::StringRef> AvailableFeatures;

public:
Mico32TargetInfo(const std::string& triple) : TargetInfo(triple) {
LM32TargetInfo(const std::string& triple) : TargetInfo(triple) {
// PointerWidth = PointerAlign = 32;
// LongWidth = LongAlign = 32;
LongLongWidth = 64;
Expand All @@ -1154,7 +1154,7 @@ class Mico32TargetInfo : public TargetInfo {
// IntMaxType = SignedLong;
// UIntMaxType = UnsignedLong;
// Int64Type = SignedLongLong;
// This must match llvm/lib/Target/Mico32/Mico32TargetMachine.cpp
// This must match llvm/lib/Target/LM32/LM32TargetMachine.cpp
// DescriptionString = "E-p:32:32:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-a0:8:8-S32-s0:32:32-n32";
// DescriptionString = "E-p:32:32:32-i8:8:32-i16:16:32-i32:32:32-i64:64:64-a0:8:8-S32-s0:32:32-n32";
DescriptionString = "E-p:32:32:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-a0:8:8-S32-s0:32:32-n32";
Expand Down Expand Up @@ -1183,7 +1183,7 @@ DescriptionString = "E-p:32:32:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:3
return "typedef char* __builtin_va_list;";
}
virtual const char *getTargetPrefix() const {
return "mico32";
return "lm32";
}
virtual void getGCCRegNames(const char * const *&Names,
unsigned &NumNames) const;
Expand Down Expand Up @@ -1223,16 +1223,14 @@ DescriptionString = "E-p:32:32:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:3

};

/// Mico32TargetInfo::getTargetDefines - Return a set of the Mico32-specific
/// LM32TargetInfo::getTargetDefines - Return a set of the LM32-specific
/// #defines that are not tied to a specific subtarget.
void Mico32TargetInfo::getTargetDefines(const LangOptions &Opts,
void LM32TargetInfo::getTargetDefines(const LangOptions &Opts,
MacroBuilder &Builder) const {
// Target identification.
Builder.defineMacro("__mico32__");
Builder.defineMacro("__lm32__");
Builder.defineMacro("_ARCH_MICO32");
Builder.defineMacro("__MICO32__");
Builder.defineMacro("__LM32__");
Builder.defineMacro("_ARCH_LM32");

// Target properties.
Builder.defineMacro("_BIG_ENDIAN");
Expand All @@ -1243,14 +1241,14 @@ void Mico32TargetInfo::getTargetDefines(const LangOptions &Opts,
}


const char * const Mico32TargetInfo::GCCRegNames[] = {
const char * const LM32TargetInfo::GCCRegNames[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
"r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
"r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31"
};

void Mico32TargetInfo::getGCCRegNames(const char * const *&Names,
void LM32TargetInfo::getGCCRegNames(const char * const *&Names,
unsigned &NumNames) const {
Names = GCCRegNames;
NumNames = llvm::array_lengthof(GCCRegNames);
Expand Down Expand Up @@ -3841,8 +3839,8 @@ static TargetInfo *AllocateTarget(const std::string &T) {
case llvm::Triple::mblaze:
return new MBlazeTargetInfo(T);

case llvm::Triple::mico32:
return new Mico32TargetInfo(T);
case llvm::Triple::lm32:
return new LM32TargetInfo(T);

case llvm::Triple::sparc:
switch (os) {
Expand Down
28 changes: 14 additions & 14 deletions lib/CodeGen/TargetInfo.cpp
Expand Up @@ -3032,14 +3032,14 @@ void MSP430TargetCodeGenInfo::SetTargetAttributes(const Decl *D,
}

//===----------------------------------------------------------------------===//
// Mico32 ABI Implementation
// LM32 ABI Implementation
//===----------------------------------------------------------------------===//

namespace {

class Mico32ABIInfo : public ABIInfo {
class LM32ABIInfo : public ABIInfo {
public:
Mico32ABIInfo(CodeGenTypes &CGT) : ABIInfo(CGT) {}
LM32ABIInfo(CodeGenTypes &CGT) : ABIInfo(CGT) {}

bool isPromotableIntegerType(QualType Ty) const;

Expand All @@ -3050,18 +3050,18 @@ class Mico32ABIInfo : public ABIInfo {
CodeGenFunction &CGF) const;
};

class Mico32TargetCodeGenInfo : public TargetCodeGenInfo {
class LM32TargetCodeGenInfo : public TargetCodeGenInfo {
public:
Mico32TargetCodeGenInfo(CodeGenTypes &CGT)
: TargetCodeGenInfo(new Mico32ABIInfo(CGT)) {}
LM32TargetCodeGenInfo(CodeGenTypes &CGT)
: TargetCodeGenInfo(new LM32ABIInfo(CGT)) {}
void SetTargetAttributes(const Decl *D, llvm::GlobalValue *GV,
CodeGen::CodeGenModule &M) const;
};

}

// Copied from MBlaze
bool Mico32ABIInfo::isPromotableIntegerType(QualType Ty) const {
bool LM32ABIInfo::isPromotableIntegerType(QualType Ty) const {
// Extend all 8 and 16 bit quantities.
if (const BuiltinType *BT = Ty->getAs<BuiltinType>())
switch (BT->getKind()) {
Expand All @@ -3079,15 +3079,15 @@ bool Mico32ABIInfo::isPromotableIntegerType(QualType Ty) const {
return false;
}

void Mico32ABIInfo::computeInfo(CGFunctionInfo &FI) const {
void LM32ABIInfo::computeInfo(CGFunctionInfo &FI) const {
FI.getReturnInfo() = classifyReturnType(FI.getReturnType());
for (CGFunctionInfo::arg_iterator it = FI.arg_begin(), ie = FI.arg_end();
it != ie; ++it)
it->info = classifyArgumentType(it->type);
}

// Copied from MIPS
ABIArgInfo Mico32ABIInfo::classifyArgumentType(QualType Ty) const {
ABIArgInfo LM32ABIInfo::classifyArgumentType(QualType Ty) const {
if (isAggregateTypeForABI(Ty)) {
// Ignore empty aggregates.
if (getContext().getTypeSize(Ty) == 0)
Expand All @@ -3110,7 +3110,7 @@ ABIArgInfo Mico32ABIInfo::classifyArgumentType(QualType Ty) const {
}

// Copied from MIPS
ABIArgInfo Mico32ABIInfo::classifyReturnType(QualType RetTy) const {
ABIArgInfo LM32ABIInfo::classifyReturnType(QualType RetTy) const {
if (RetTy->isVoidType())
return ABIArgInfo::getIgnore();

Expand All @@ -3128,12 +3128,12 @@ ABIArgInfo Mico32ABIInfo::classifyReturnType(QualType RetTy) const {
}


void Mico32TargetCodeGenInfo::SetTargetAttributes(const Decl *D,
void LM32TargetCodeGenInfo::SetTargetAttributes(const Decl *D,
llvm::GlobalValue *GV,
CodeGen::CodeGenModule &M) const {
}

llvm::Value *Mico32ABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
llvm::Value *LM32ABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
CodeGenFunction &CFG) const {
return 0;
}
Expand Down Expand Up @@ -3611,8 +3611,8 @@ const TargetCodeGenInfo &CodeGenModule::getTargetCodeGenInfo() {
case llvm::Triple::mblaze:
return *(TheTargetCodeGenInfo = new MBlazeTargetCodeGenInfo(Types));

case llvm::Triple::mico32:
return *(TheTargetCodeGenInfo = new Mico32TargetCodeGenInfo(Types));
case llvm::Triple::lm32:
return *(TheTargetCodeGenInfo = new LM32TargetCodeGenInfo(Types));

case llvm::Triple::msp430:
return *(TheTargetCodeGenInfo = new MSP430TargetCodeGenInfo(Types));
Expand Down

0 comments on commit cf78366

Please sign in to comment.