Commit b5cc5246 authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Corrected dead code elimination

parent 814f2c24
...@@ -406,7 +406,7 @@ aspect C_Declarations { ...@@ -406,7 +406,7 @@ aspect C_Declarations {
public void Decl.C_emitEncoderDeclaration(C_env env) { public void Decl.C_emitEncoderDeclaration(C_env env) {
} }
//
public void SampleDecl.C_emitEncoderDeclaration(C_env env) { public void SampleDecl.C_emitEncoderDeclaration(C_env env) {
env.println("int labcomm"+env.verStr+"_encoder_register_" + env.println("int labcomm"+env.verStr+"_encoder_register_" +
env.prefix + getName() + "("); env.prefix + getName() + "(");
...@@ -1252,6 +1252,7 @@ aspect C_TypeDependencies { ...@@ -1252,6 +1252,7 @@ aspect C_TypeDependencies {
} }
} }
} }
public void Decl.C_emitUserTypeRefs(C_env env, String via, boolean outputCode) { public void Decl.C_emitUserTypeRefs(C_env env, String via, boolean outputCode) {
if( isReferenced() ) { if( isReferenced() ) {
Iterator<Decl> it = type_references().iterator(); Iterator<Decl> it = type_references().iterator();
...@@ -1283,27 +1284,15 @@ aspect C_Signature { ...@@ -1283,27 +1284,15 @@ aspect C_Signature {
eq TypeDecl.C_DeclTypeString() = "LABCOMM_TYPEDEF"; eq TypeDecl.C_DeclTypeString() = "LABCOMM_TYPEDEF";
public void Decl.C_emitSignature(C_env env) { public void Decl.C_emitSignature(C_env env) {
if( (isReferenced() || isSampleDecl())){ if( (isReferenced() || isSampleDecl())){
Signature signature = getSignature(); Signature signature = getSignature();
signature.C_emitSignature(env, !isSampleDecl()); signature.C_emitSignature(env, !isSampleDecl());
} else { C_emitFlatSignature(env);
env.println("// not emitting signature for "+getName()+isReferenced()+isSampleDecl()); } else {
} env.println("// not emitting signature for " + getName() +
C_emitFlatSignature(env); "referenced=" + isReferenced() +
"sampledecl=" + isSampleDecl());
}
// if(env.versionHasMetaData()) {
// if(isReferenced() || isSampleDecl()){
// env.println("(int (*)(void *))labcomm"+env.verStr+"_signature_" +
// env.prefix + getName() + "_emit_signature");
// } else {
// env.println("NULL"); // HERE BE DRAGONS! Is it worth the size saving to skip emitting the emit_signature function for unused types?
// // The code won't likely end up in a target system anyway?
// }
// }
// env.unindent();
// env.println(" };");
//
} }
public void ASTNode.C_emitFlatSignature(C_env env) { public void ASTNode.C_emitFlatSignature(C_env env) {
...@@ -1312,7 +1301,7 @@ aspect C_Signature { ...@@ -1312,7 +1301,7 @@ aspect C_Signature {
" not declared"); " not declared");
} }
public void Decl.C_emitFlatSignature(C_env env) { public void TypeDecl.C_emitFlatSignature(C_env env) {
C_emitSizeofValue(env); C_emitSizeofValue(env);
env.println("static struct labcomm"+env.verStr+"_signature " + env.println("static struct labcomm"+env.verStr+"_signature " +
"signature_" + env.prefix + getName() + " = {"); "signature_" + env.prefix + getName() + " = {");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment